BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sasjourney
Calcite | Level 5

Hi,

Is there anyway to determine the path of SAS executable (SAS.exe) dynamically?

Thanks


1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

If you are running on Windows then you can use %SYSGET() to find the value of SASROOT.

So sas.exe should be at

%let location=%sysget(sasroot)\sas.exe ;

View solution in original post

6 REPLIES 6
Tom
Super User Tom
Super User

Look at the setting of the option PATH.

%put %sysfunc(getoption(path));

It might look like this:  !SASROOT/sasexe

One way to translate !SASROOT into a path is to use it in a FILENAME or LIBNAME statement.

filename x "%sysfunc(getoption(path))";

%put %sysfunc(pathname(x));

sasjourney
Calcite | Level 5

Hi Tom,

I have the following paths for %put %sysfunc(getoption(path)) and don't see sasroot.

( "!sasext0\aacomp\sasexe" "!sasext0\statcomp\sasexe"

"!sasext0\core\sasexe" "!sasext0\tablesrvtk\sasexe"

"!sasext0\access\sasexe" "!sasext0\af\sasexe"

"!sasext0\assist\sasexe" "!sasext0\connect\sasexe"

"!sasext0\eis\sasexe" "!sasext0\ets\sasexe"

"!sasext0\fsp\sasexe" "!sasext0\graph\sasexe"

"!sasext0\stat\sasexe" "!sasext0\spdsclient\sasexe"

"!sasext0\aacomp\sasexe" "!sasext0\statcomp\sasexe"

"!sasext0\core\sasexe" "!sasext0\tablesrvtk\sasexe"

"!sasext0\access\sasexe" "!sasext0\af\sasexe"

"!sasext0\assist\sasexe" "!sasext0\connect\sasexe"

"!sasext0\eis\sasexe" "!sasext0\ets\sasexe"

"!sasext0\fsp\sasexe" "!sasext0\graph\sasexe"

"!sasext0\stat\sasexe" "!sasext0\spdsclient\sasexe"

Thanks

Tom
Super User Tom
Super User

If you are running on Windows then you can use %SYSGET() to find the value of SASROOT.

So sas.exe should be at

%let location=%sysget(sasroot)\sas.exe ;

sasjourney
Calcite | Level 5

Thanks Tom, this worked

MikeZdeb
Rhodochrosite | Level 12

hi ... there must be something shorter than this ...

filename temp temp;

proc printto log=temp;

proc options option=set;

proc printto;

data _null_;

infile temp;

input @ '[SASROOT = ' text $100.;

call symputx('root',scan(text,1,'"'));

run;


%put &root;

C:\SAS_9_3\SASFoundation\9.3

sasjourney
Calcite | Level 5

Hi Mike,

I tried this but for some reason it gives me the path of sasext1 instead of sasroot. I tried by reducing the length for the variable text to $50. and seems like thats working but didn't understand why it gives me a different path if length is $100.

Thanks

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!

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.

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
  • 6 replies
  • 11706 views
  • 0 likes
  • 3 in conversation