[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3332
  • Last Modified:

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):

%INCLUDE 'xformat.sas';
WARNING: Physical file does not exist, C:\WINDOWS\system32\xformat.sas.
ERROR: Cannot open %INCLUDE file xformat.sas.

The sas file this include line is in is in the same folder as the file it is trying to include (xformat.sas).
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!!!

0
sah18
Asked:
sah18
  • 3
  • 3
1 Solution
 
bradanelsonCommented:
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\xformat.sas"
0
 
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.
0
 
bradanelsonCommented:
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:

-SASINITIALFOLDER="C:\data\sasjobs"

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.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
sah18Author Commented:
I'm getting this message back:

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


0
 
bradanelsonCommented:
Use double quotes.  SAS will not look inside of single quotes for global variables.
0
 
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!!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now