Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Home Folder when running SAS under Windows 1

Status
Not open for further replies.

TonyH217

Programmer
Aug 22, 2007
6
GB
I am trying to find a way of getting the Environment Variables while running SAS under Windows XP O/S. I need to be able to find the 'Home' folder. Have tried %sysget but this probably only works for Unix. I am using SAS Base Version 8.02.
Thanks in advance for any help.
Tony
 
Yes there is a way. You can use a PIPE to read the results of the DOS 'SET' command.

Here is an example:
Code:
*** TO GET THE ENV VARS FROM WINDOWS ***;
filename env pipe 'set';

data test;
 infile env;
 length vars $ 500;
 infile env lrecl=2000;
 input vars &;
 varname = scan(vars,1,'=');
 value   = scan(vars,2,'=');
 put vars varname value;
run;

Now all you need to do is use this dataset to create your macro variables with the info you need.

like this:
Code:
data _null_;
  set test end=last;
  call symput(trim(varname), trim(value) );
run;


hope this helps you.
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top