DATA Step, Macro, Functions and more

sas.exe path

Accepted Solution Solved
Reply
Contributor
Posts: 43
Accepted Solution

sas.exe path

Hi,

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

Thanks



Accepted Solutions
Solution
‎07-31-2012 01:33 PM
Super User
Super User
Posts: 7,039

Re: sas.exe path

Posted in reply to sasjourney

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


All Replies
Super User
Super User
Posts: 7,039

Re: sas.exe path

Posted in reply to sasjourney

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

Contributor
Posts: 43

Re: sas.exe path

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

Solution
‎07-31-2012 01:33 PM
Super User
Super User
Posts: 7,039

Re: sas.exe path

Posted in reply to sasjourney

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 ;

Contributor
Posts: 43

Re: sas.exe path

Thanks Tom, this worked

Valued Guide
Posts: 765

Re: sas.exe path

Posted in reply to sasjourney

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

Contributor
Posts: 43

Re: sas.exe path

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 1520 views
  • 0 likes
  • 3 in conversation