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-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

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