Hi,
I have attempted to export a SAS dataset to .csv using the following piece of code but to no avail:
PROC EXPORT DATA=XXX;
OUTFILE="File Pathname"
DBMS=CSV REPLACE;
PUTNAMES=YES;
RUN;
In fact, I received an error message that states the following:
ERROR: FILE= or TABLE= is required and must be specified.
Therefore, I would greatly appreciate it if someone could offer a solution to this issue. Thanks in advance!
Remove the highlighted Semi-colon and try
PROC EXPORT DATA=XXX ;
OUTFILE="File Pathname"
DBMS=CSV REPLACE;
PUTNAMES=YES;
RUN;
Should be :
PROC EXPORT DATA=XXX
OUTFILE="File Pathname"
DBMS=CSV REPLACE;
PUTNAMES=YES;
RUN;
Thank you so much for detecting that error! It works now!
You have to remove the semi-colon after DATA=XXX;
Thank you so much for detecting that error! It works now!
Here is a coding style tip to help avoid that type of error.
When you have a statement that spans multiple lines put the semi-colon that ends the statement on its own line:
PROC EXPORT DATA=XXX
OUTFILE="File Pathname"
DBMS=CSV REPLACE
;
PUTNAMES=YES;
RUN;
The same way that you would place the END for a DO/END block:
if a=b then do;
statement1;
statement2;
end;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.