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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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