BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
beir
Calcite | Level 5

Hello all,

I am new to SAS. I am trying to export some data from WRDS to excel.

I am using the following code:

 


PROC SQL;
CREATE TABLE WORK.query AS
SELECT 'Name'n FROM CISDM.ACTIVE_FUND_INFO;
RUN;
QUIT;

PROC DATASETS NOLIST NODETAILS;
CONTENTS DATA=WORK.query OUT=WORK.details;
RUN;

PROC PRINT DATA=WORK.details;
RUN;

PROC EXPORT DATA=WORK.query;
outfile='/home/qmul/beir/sasuser.v94/Book1'
dbms=xlsx
run;



I have uploaded an empty Excel file to SAS. The error I get is:
ERROR: FILE=OR TABLE= is required and must be satisfied.

Could you please help me with this?
Thank you very much.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

PROC SQL;
CREATE TABLE WORK.query AS
SELECT 'Name'n FROM CISDM.ACTIVE_FUND_INFO;
RUN;
QUIT;

PROC DATASETS NOLIST NODETAILS;
CONTENTS DATA=WORK.query OUT=WORK.details;
RUN;

PROC PRINT DATA=WORK.details;
RUN;

PROC EXPORT DATA=WORK.query
outfile='/home/qmul/beir/sasuser.v94/Book1.xlsx'
dbms=xlsx replace;
run;
  1. Remove semicolon after DATA= (too early)
  2. Add extension to file name, Book1.xlsx
  3. Add Replace to specify that it should write over any other Book1
  4. Add Semicolon after Replace

@beir wrote:

Hello all,

I am new to SAS. I am trying to export some data from WRDS to excel.

I am using the following code:

 


PROC SQL;
CREATE TABLE WORK.query AS
SELECT 'Name'n FROM CISDM.ACTIVE_FUND_INFO;
RUN;
QUIT;

PROC DATASETS NOLIST NODETAILS;
CONTENTS DATA=WORK.query OUT=WORK.details;
RUN;

PROC PRINT DATA=WORK.details;
RUN;

PROC EXPORT DATA=WORK.query;
outfile='/home/qmul/beir/sasuser.v94/Book1'
dbms=xlsx
run;



I have uploaded an empty Excel file to SAS. The error I get is:
ERROR: FILE=OR TABLE= is required and must be satisfied.

Could you please help me with this?
Thank you very much.

 


 

View solution in original post

4 REPLIES 4
andreas_lds
Jade | Level 19

A semicolon is missing after "dbms=xlsx".

sbxkoenk
SAS Super FREQ

Hello,

 

What is WRDS? Wharton Research Data Services?

 

To start with, I think your

outfile='/home/qmul/beir/sasuser.v94/Book1'

should be

outfile='/home/qmul/beir/sasuser.v94/Book1.xlsx'

 

Koen

 

Reeza
Super User

PROC SQL;
CREATE TABLE WORK.query AS
SELECT 'Name'n FROM CISDM.ACTIVE_FUND_INFO;
RUN;
QUIT;

PROC DATASETS NOLIST NODETAILS;
CONTENTS DATA=WORK.query OUT=WORK.details;
RUN;

PROC PRINT DATA=WORK.details;
RUN;

PROC EXPORT DATA=WORK.query
outfile='/home/qmul/beir/sasuser.v94/Book1.xlsx'
dbms=xlsx replace;
run;
  1. Remove semicolon after DATA= (too early)
  2. Add extension to file name, Book1.xlsx
  3. Add Replace to specify that it should write over any other Book1
  4. Add Semicolon after Replace

@beir wrote:

Hello all,

I am new to SAS. I am trying to export some data from WRDS to excel.

I am using the following code:

 


PROC SQL;
CREATE TABLE WORK.query AS
SELECT 'Name'n FROM CISDM.ACTIVE_FUND_INFO;
RUN;
QUIT;

PROC DATASETS NOLIST NODETAILS;
CONTENTS DATA=WORK.query OUT=WORK.details;
RUN;

PROC PRINT DATA=WORK.details;
RUN;

PROC EXPORT DATA=WORK.query;
outfile='/home/qmul/beir/sasuser.v94/Book1'
dbms=xlsx
run;



I have uploaded an empty Excel file to SAS. The error I get is:
ERROR: FILE=OR TABLE= is required and must be satisfied.

Could you please help me with this?
Thank you very much.

 


 

Reeza
Super User
Exporting to the sasuser folder is a weird location to export files.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 4 replies
  • 2274 views
  • 2 likes
  • 4 in conversation