Follow the instructions for your software to create a macro variable that stores the location for output files.
SAS Studio
%let outpath=filepath-to-output-folder;
You already gave the answer yourself in your initial post. Just replace the italic string with the string that contains your path.
Thank you so much for your help.
Yes... thank you all for your help.
Hi:
In SAS Studio, right click on the OUTPUT folder under your EPG194 main folder. Choose Properties. In the location field, the full path should be revealed to you. Highlight and copy this path with Ctrl+C. then highlight the italics (shown in pink below):
%let outpath=filepath-to-output-folder;
and replace (Ctrl+V) the highlighted string with the path location you copied from Properties. Possibilities for all the different ways to use SAS are:
Most frequently used free methods:
SAS University Edition: %let outpath=/folder/myfolders/EPG194/output;
SAS OnDemand for Academics: %let outpath=/home/<your_userid>/EPG194/output;
OR %let outpath=~/EPG194/output;
Other methods of using SAS:
C: drive with local SAS: %let outpath=C:\SAS_class\EPG194\output;
Unix Installation: %let outpath=/usr/bin/SAS_class/EPG194/output;
Enterprise Guide: %let outpath = %sysfunc(pathname(work)); (no write access to C: drive)
OR %let outpath = c:\SAS_class\EPG194\output; (with write access to C: drive)
Any time in the course where you have seen the string 'FILEPATH' or 'filepath-to-folder', you've needed to replace that string with a path location -- usually the path to the data folder. The only difference here is that you are using the locatioin of the OUTPUT folder.
Hope this helps,
Cynthia
Thank you for your help CYNTHIA. Really appreciated!
I am struggling getting past this first step of defining a file path using the %let macro code. Specifically, after running the code (SAS Studio - University Edition), with the correct path, the code runs but I cannot see anything in the log to indicate the macro variable was created. When calling in the macro variable in the Proc Export activity - the program does not recognize the &outpath macro so no table is produced. I tried a few different ways of running the %let to define the &outpath macro variable and proc export program to produce the pg1.storm_final SAS table but cannot get past this exercise.
Quick question, after running the following exercise - the following code - what should I see in the log? How do I know the &outpath macro variable was successfully created and available to use in the proc export exercise?
%let outpath=/folders/myfolders/EPG1V2/output;
When you run this, and nothing else appears in the log, then you can safely assume it worked.
To check, run this:
%put &=outpath.;
Kurt -
Thank you for your help....I was able to successfully complete the exercise - and output the .csv file to the output folder.
Hi:
If you have successfully changed your LIBNAME.SAS program, as shown below,these 2 activities are linked:
Once you update LIBNAME.SAS with the %LET statement and run the code, assuming that you have the correct location of your OUTPUT folder, the macro variable should resolve correctly. You can use the %PUT statement to verify the value of &OUTPATH, as shown below:
However, if you spelled the folder path wrong, the %PUT doesn't do you any good here. What really matters is whether the output file got exported correctly to the /folders/myfolders/EPG1V2/output folder when you run the code to create the storm_final.csv file. In my SAS log, it shows in the NOTES what the value of &outpath was, how it was used and whether the program code was successful. You can see the resolved name in the LOG messages below:
I hope this helps clarify that when we refer to using &OUTPATH, we expect that you have done the required setup for creating the macro variable. As shown in my code, for SAS University Edition, assuming you made the data according to the instructions, your data folder full path should be:
/folders/myfolders/EPG1V2/data
and the output folder full path should be:
/folders/myfolders/EPG1V2/output
Cynthia
It looks like you have wrapped the macro variable OUTPATHONE's value in unbalanced quotes. It shouldn't need quotes at all:
%let OUTPATHONE = /EPG194/output;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.