BookmarkSubscribeRSS Feed
Xinxin
Obsidian | Level 7

Hello,

I have SAS EG on my local computer. I have a profile for local and one for the server. I do all the data processing and saving on the SAS server. But I want to include a program which is on local and run it on the server with a statement like this:

%include "C:\Documents and Settings\myname\Desktop\Code\For SAS Server\QTR_START_END.sas";

And I get this error:     

WARNING: Physical file does not exist, /sas93/config/Lev1/SASApp/C:\Documents and Settings\myname\Desktop\Code\For SAS Server\QTR_START_END.sas

ERROR: Cannot open %INCLUDE file C:\Documents and Settings\myname\Desktop\Code\For SAS Server\QTR_START_END.sas

I want to use this %include because I use this program in many SAS EG projects but want to change it only once.

Thanks, in advance for any help!   

1 REPLY 1
TimCampbell
Quartz | Level 8

Hi Xinxin,

When you are connected to the server the %include line will search the server rather than your PC for files since that is where all the code runs.

The quickest solution would be to copy your QTR_START_END.sas to some location on your server and then change your code to point to that path, then when you make changes to the version on your PC you will need to remember to copy them over to the server version.

If you want to be able to retain the ability to swith the code between a local and server environment I would sugest putting the path to the directory containing the code into a macro variable in the workspace server autoexec (usermods) both on the server and on your PC.

something like this on your pc,

%let code_path = C:\Documents and Settings\myname\Desktop\Code\For SAS Server\;

and this on the server

%let code_path = /your directory path/;

the file to change on the server is probably /app/sas93/config/Lev1/SASApp/appserver_autoexec_usermods.sas or alternatively make the change in the /app/sas93/config/Lev1/SASApp/WorkspaceServer/appserver_autoexec_usermods.sas to only affect workspace server sessions.

You will probably need to restart the SAS servers on the server for this to take effect. /app/sas93/config/Lev1/sas.servers restart.

then use %include "&codepath.QTR_START_END.sas"; in your program. This will mean that running the code on your pc will use the PC version of the code and the server will use the server version.

If you want to use exactly the same file for both environments rather then 2 copies you would probably need to set up a samba share or equivalent on your server that you PC can access, just store the code on the server and do the same thing with the macro variable so that each environment knows how to access the file.

Hope this helps,

Tim

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 4071 views
  • 0 likes
  • 2 in conversation