DATA Step, Macro, Functions and more

create temporary table in SAS

Reply
Occasional Contributor
Posts: 7

create temporary table in SAS

 Hi ,

I am trying to create a temporary table in SAS with below code:

PROC SQL;
CREATE VOLATILE TABLE TEMP AS
(SELECT * FROM SASHELP.AIR)
;
QUIT;

 

and I m getting the following error

 

'Syntax error, expecting one of the following: DISTINCT, INDEX, TABLE, UNIQUE, VIEW'
 
KIndly help. 
Super User
Posts: 5,437

Re: create temporary table in SAS

You are trying to use RDBMS specific syntax.
A temporary table in SAS has the predefined "schema" (libref in SAS terminology) called work.
An equal syntax is to use a one level table specification, work is assumed.
Data never sleeps
Occasional Contributor
Posts: 7

Re: create temporary table in SAS

Hi LinusH,

 

Can you clarify more on how can I create a MULSET VOLATILE tabe in SAS?

 

 

Super User
Posts: 19,861

Re: create temporary table in SAS

Check SAS documentation for SQL. There is no VOLATILE in SAS SQL, and not in all SQL implementations either AFAIK.

 

PROC SQL;
CREATE TABLE TEMP AS
(SELECT * FROM SASHELP.AIR)
;
QUIT;

http://support.sas.com/documentation/cdl/en/sqlproc/69822/HTML/default/viewer.htm#n07kfcv1vbih8rn1k9...

Respected Advisor
Posts: 4,931

Re: create temporary table in SAS

Do

 

PROC SQL;
CREATE TABLE WORK.TEMP AS
SELECT * FROM SASHELP.AIR;
QUIT;

or simply

PROC SQL;
CREATE TABLE TEMP AS
SELECT * FROM SASHELP.AIR;
QUIT;

since WORK is the default library.

PG
Ask a Question
Discussion stats
  • 4 replies
  • 1165 views
  • 2 likes
  • 4 in conversation