SAS 9.1 - Getting error on %INCLUDE line of program - not sure how to set the path to the file being included

I'm trying to run a SAS program that was provided with software we purchased for work.  I've used SAS ages ago, but really don't know it.  I do know programming in general, just not in SAS.  I am running SAS 9.1 for Windows.  Here is where the program is getting stuck (quite early on, I might add):

WARNING: Physical file does not exist, C:\WINDOWS\system32\
ERROR: Cannot open %INCLUDE file

The sas file this include line is in is in the same folder as the file it is trying to include (
I don't know why it is looking in C:\WINDOWS\system32 for the file, but it certainly is not there!
There are many, many of these includes throughout the program.  I'd like to know how to get past this error, so that it can locate all these include files.

Thanks for your help!  Oh, of course, this is somewhat urgent!!!

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If all the files reside in on location you can create a global variable and refrence it in all the include path names.  ex
All the .sas files you are including exist in C:\data\sasjobs then I would write something like this:

%LET HomeDir=C:\data\sasjobs;
%INCLUDE "&HomeDir\"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sah18Author Commented:
I will give this a try and post back.

I do have another question on this.  What determines where SAS is looking for these files?  I'm wondering if something in my install wasn't set correctly, since this was a provided sas program and should work without modification.

Thanks again.
The install was probally successfull.  You can adjust the .cfg file for sas to point to a different folder when ran.  For SAS 9.1 installs, typically the .cfg file is loacated here: C:\Program Files\SAS\SAS 9.1\nls\en\SASV9.CFG

Look for the option -SASINITIALFOLDER.  If it doesn't exist you can set it.  Here is an example:


When you open a new sas session it will be pointing to this directory.

The problem with this solution is that it is machine specific, which makes the program less portable.  I would stilll reccomend coding the full path to where the file exists in your INCLUDE.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

sah18Author Commented:
I'm getting this message back:

32   %INCLUDE '&HomeDir\';
WARNING: Physical file does not exist, C:\WINDOWS\system32\&HomeDir\
ERROR: Cannot open %INCLUDE file &HomeDir\

Use double quotes.  SAS will not look inside of single quotes for global variables.
sah18Author Commented:
Thank you so much - this got me past this issue.  I may have further questions about this same script, but I will post them as individual questions, of couse, so you may see another one from me!  Thank you so much!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.