SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

1) I know a SAS code written in UNIX has used following option to print working directory in SAS output.

%sysget(PWD)

I am looking for similar option for windows which can print my windows directory in my SAS output. I also like to know if there is any option available, how will it print the output. It will print "C:/USER" or if I am working on shared drive it will print "//mxit12/USER".

2) I also like to know the macro variable or any other option to print the name of current SAS code I am running in output. For example if I am running code jig1.sas then it will print jig1.sas in output and then next I am running jig2.sas, it should print jig2.sas in output. I thought following macro variable does the same.

%sysfunc(scan(&SYSPROCESSNAME,2))

But it always gives me "PROCESS" in return instead of SAS code name.

Thanks,

Jig.
2 REPLIES 2
LawrenceHW
Quartz | Level 8
SYSPROCESNAME will return DMS Process if you're executing interactive SAS which is what (I suspect) is happening here.

SYSPROCESSNAME will return the program path and filename when batch executing.

You can check what SYSPROCESSNAME gives you in the LOG file but submitting "%PUT &SYSPROCESSNAME;" in the program editor.

Lawrence Message was edited by: LawrenceHW

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
  • 2 replies
  • 896 views
  • 0 likes
  • 2 in conversation