BookmarkSubscribeRSS Feed
yli33
Fluorite | Level 6

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!

6 REPLIES 6
Reeza
Super User
Can you post your log please.
r_behata
Barite | Level 11

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;

yli33
Fluorite | Level 6

Thank you so much for detecting that error! It works now!

EPasol
Calcite | Level 5

You have to remove the semi-colon after DATA=XXX;

yli33
Fluorite | Level 6

Thank you so much for detecting that error! It works now!

Tom
Super User Tom
Super User

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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 6 replies
  • 3082 views
  • 6 likes
  • 5 in conversation