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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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