I am unable to find the error even though the syntax is correct. Please help me with this one.
98 %let outpath = "/folders/myfolders/EPG194/output";
Macro variables generally should not have quotes around their values, and in this particular case, is the cause of your error. Remove the quotes.
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.
in coursera answer is 3092 worked and got it. use the file path correctly u will get it
Hi Vishnu,
It will be of great help if you can please provide the code. Your answer is right.
Hi:
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
%let outpath=/home/userID/EPG1V2/output;
So if your userID was u1234567, then your path location for the output file would be something like:
%let outpath=/home/u1234567/EPG1V2/output;
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.
Cynthia
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.