I am unable to find the error even though the syntax is correct. Please help me with this one.
When defining a macro variable, everything up to the first (unmasked) semicolon (excluding leading and trailing blanks) becomes part of the content of the macro variable. This includes any quotes. So your OUTFILE option becomes this after the macro variable is resolved:
outfile = "/"/folders/myfolders/EPG194/output"/storm_final.csv"
which can't be interpreted as valid code. Work out for yourself how you have to change the macro variable to create valid code.
The path that starts /folders/myfolders is an older path so you are looking at code that is an example of solving this problem on our old SAS University Edition product, which has now been retired.
If you are using SAS OnDemand for Academics, then the path to your output folder should be something like
So if your userID was u1234567, then your path location for the output file would be something like:
To find the correct path, as explained many times before Lesson 6, open the Server Files and Folders panel and right click on the output subfolder under the EPG1V2 class folder. In the popup window when you right click, choose Properties and the path that you see in the Properties window for the output folder is the path you should use WITHOUT quotes (as already noted) in the %LET statement to make the &outpath helper macro variable.
A dot terminates a macro variable reference. It vanishes when the macro variable is resolved.
If you need the contents of a macro variable followed by a dot in a string, you must use two dots: one to terminate the macro variable reference, the other to end up in the string.
I also suspect that your macro variable &outpath contains the path to a directory, so you must add a file name:
proc export data=np.storm_final outfile="&outpath./storm_final.csv" dbms=csv replace ;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.