Help using Base SAS procedures

Exporting files to a relative path

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

Exporting files to a relative path

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.


Accepted Solutions
Solution
‎07-20-2011 06:16 AM
Occasional Contributor
Posts: 11

Exporting files to a relative path

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


All Replies
Frequent Contributor
Frequent Contributor
Posts: 94

Exporting files to a relative path

Posted in reply to JamesNewcombe

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.

Solution
‎07-20-2011 06:16 AM
Occasional Contributor
Posts: 11

Exporting files to a relative path

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!

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 1166 views
  • 3 likes
  • 2 in conversation