SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
SP_SAS
Obsidian | Level 7

I am running sas 9.4 on grid platform. I want to get the value of the path of my sas program automatically in sas. I use the below code but it gives me the sas workspace location and not my user directory where my program is saved. Any ideas?

%put The current program is %sysfunc(getoption(sysin));

 

/gridwork/userid/SASGSUB-2017-01-12_13.05.07.758_abc/abc.sas

 

insted of this I want path of my directory where abc.sas is actually saved.

 

Thanks,

Santosh

 

3 REPLIES 3
ballardw
Super User

This may work:

%sysget(SAS_EXECFILEPATH)

It is the result of a macro function so could be used as:

title "Program name: %sysget(SAS_EXECFILEPATH)";

or

%let File = %sysget(SAS_EXECFILEPATH);

 

It returns the path and name after a file is saved in base SAS. I don't know if it will work in a grid environment.

SmithCJGVSU
Obsidian | Level 7

@ballardw I think SAS_EXECFILEPATH is only for Windows and the Enhanced Editor.  And, also for interactive mode.

 

@SP_SAS, Did you ever find a solution to this problem?  I'm running into your same problem when running on SAS GRID and I'd be very curious if it's possible to obtain the path dynamically.

 

 

SASKiwi
PROC Star

@SmithCJGVSU - Why do you think a new SAS server session will somehow know where your SAS programs are stored if you haven't identified any of these programs to SAS first? A brand-new SAS session will only know the location of where it was started from and nothing about what programs you want it to run.

 

I find it useful to set up a macro variable containing the folder location of the required SAS application in a program controlling that application.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 5048 views
  • 1 like
  • 4 in conversation