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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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