Buras
Buras

Reputation: 3099

How to keep the result set in SAS

How can I write the result set from a select statement in a sas table ?

execute (
SELECT * 
FROM test
)
...

/* How to write this into SAS table now 
data mytable;
set theAboveResultSet

Upvotes: 0

Views: 62

Answers (2)

biyectivo
biyectivo

Reputation: 33

You need to add CREATE TABLE xxx AS in your PROC SQL statement:

PROC SQL NOPRINT;
  CREATE TABLE mylib.mydataset AS
  SELECT ...
  ;
QUIT;

Upvotes: 3

Joe
Joe

Reputation: 63434

Assuming you are using some sort of pass-through SQL here.

proc sql;
connect to oledb (init_String= ...) ;
select * from connection to oledb (
  select ... from ... 
);
quit;

That is for a simple select query. If you're doing an execute (such as a stored procedure), you need to have that Stored Proc save the data to a temporary table or view and perform a select from that. As far as I know you can't select from an execute directly.

Upvotes: 1

Related Questions