BookmarkSubscribeRSS Feed
JAM50
Calcite | Level 5

Good Afternoon,

 

I have a dataset that I am trying to export to a .csv file.  I am using SAS 9. See below

 

PROC EXPORT DATA=ASJ2;

OUTFILE='c:\Users\jmitchel\Documents\ASJ2_Test.csv';

DBMS=CSV

RUN;

 

I get the following error.

 

ERROR: FILE= OR TABLE=  is required and must be specified. 

 

What is causing this error?

 

 

6 REPLIES 6
Tom
Super User Tom
Super User

You have and extra semi-colon. It is ending the PROC statement too soon.

I find that it really helps when you have a multi-line statement to place the ending semi-colon on a new line. Like you would do with an END statement.

 

PROC EXPORT
  DATA=ASJ2
  OUTFILE='c:\Users\jmitchel\Documents\ASJ2_Test.csv'
  DBMS=CSV
;
RUN;
JAM50
Calcite | Level 5

Thank You!

SamiMajdalanyMD
Calcite | Level 5

Hi, 

 

I'm getting a similar error ( ERROR: FILE= or TABLE= is required and must be specified.), but I believe my ; are correct already

 

My code is:

 

proc export data=_temp1.bladder;
outfile=/home/u59515136/Jakob/bladder.xlsx;
dbms=xlsx replace;
run;

Tom
Super User Tom
Super User

Because you have the exact same syntax error as the original post. You have inserted semi-colons that end the PROC STATEMENT too soon.

But you also have another error.  You also have not quoted the physical pathname.

proc export data=_temp1.bladder 
  outfile="/home/u59515136/Jakob/bladder.xlsx"
  dbms=xlsx replace
;
run;
SamiMajdalanyMD
Calcite | Level 5

Thanks! Is the physical path name the location of the file in FILES (HOME)? where do I paste that in the code please

Tom
Super User Tom
Super User

Since you are using PROC EXPORT the file does not have to exist before the PROC runs.  The PROC will write it.

 

If you are using some interface to run your SAS code, like SAS/Studio, then the path has to one that is valid on the machine where SAS itself is running.  You can check the properties of an existing file in your HOME folder and see how the path should be specified.  Yes you can copy and paste the path as displayed by the properties tab in SAS/studio into your code to make sure you have typed it correctly.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 12613 views
  • 0 likes
  • 3 in conversation