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;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3238 views
  • 6 likes
  • 5 in conversation