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

Hello

My SAS program uses Proc Export to write out a CSV file. I want to be able to write the file into a "Data" folder inside the same folder where I've stored my SAS program. If I copy my SAS program to a different folder and run it I want the CSV to automatically be written into data folder in the the new location. I don't want to have to keep manually altering the path in the program.

Does anyone know how I can do this? it must be possible!

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
JamesNewcombe
Calcite | Level 5

I had look at it and coded this:

%let ipath = %sysget(SAS_EXECFILEPATH);

Which gets the current path where the SAS program is stored. Now I can easily add this into my Proc Export.

Thanks for your help!

View solution in original post

2 REPLIES 2
DF
Fluorite | Level 6 DF
Fluorite | Level 6

Perhaps the macro variables SAS_EXECFILEPATH and SAS_EXECFILENAME will help?  There are some more details here: http://support.sas.com/documentation/cdl/en/hostwin/63047/HTML/default/viewer.htm#editor_enhanced.ht... .

Sadly my setup doesn't allow me to create an example for you, but it sounds like they might help.

If they work for you, you should be able to parse the text of the full path to your program, and work out the full path of your desired folder.

JamesNewcombe
Calcite | Level 5

I had look at it and coded this:

%let ipath = %sysget(SAS_EXECFILEPATH);

Which gets the current path where the SAS program is stored. Now I can easily add this into my Proc Export.

Thanks for your help!

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4928 views
  • 3 likes
  • 2 in conversation