how to create SAS file after proc sql?

Accepted Solution Solved
Reply
Super Contributor
Posts: 319
Accepted Solution

how to create SAS file after proc sql?

Hello:

 

How to generate a SAS file after proc sql?  Thanks.

 

proc sql;
select score from test1
intersect all
select score from test2;
quit;


Accepted Solutions
Solution
‎06-01-2017 08:20 AM
Trusted Advisor
Posts: 1,019

Re: how to create SAS file after proc sql?

Precede the SELECT clause with a CREATE TABLE clause:

 

proc sql;

  create table mytable as

  select score from test1

  intersect all

  select score from test2;

quit;

View solution in original post


All Replies
Solution
‎06-01-2017 08:20 AM
Trusted Advisor
Posts: 1,019

Re: how to create SAS file after proc sql?

Precede the SELECT clause with a CREATE TABLE clause:

 

proc sql;

  create table mytable as

  select score from test1

  intersect all

  select score from test2;

quit;

Super User
Posts: 19,810

Re: how to create SAS file after proc sql?

The documentation is pretty good for SQL - see the section titled 'Creating Tables'

 

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

Super Contributor
Posts: 319

Re: how to create SAS file after proc sql?

My SAS version is 9.3, not 9.4

Super User
Posts: 11,343

Re: how to create SAS file after proc sql?

[ Edited ]

ybz12003 wrote:

My SAS version is 9.3, not 9.4


It won't hurt to look at basics of SQL documentation. The basic elements such as Create Table , Select, From, Group By and where clauses haven't changed drastically since SAS 6.8. There may be as few additional features here and there but just as the data step, except for adding new functions, changes slowly so does the base SQL definition.

 

And if you hunt around you will find the version 9.3 documentation on the SAS support website as well.

 

I would also ask why the online help was not installed with your installation. Does the F1 key bring up anything for SAS?

Super User
Posts: 19,810

Re: how to create SAS file after proc sql?


ybz12003 wrote:

My SAS version is 9.3, not 9.4


It really doesn't matter for this topic, the major difference is with FEDSQL and MEDIAN function, neither of which you appear to be using. And you can find the same section in the 9.3 documentation, if you choose to look. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 140 views
  • 1 like
  • 4 in conversation