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

Hi,

 

I'm fairly new to SAS and was wondering if I can have multiple "queries"/sql statements in proc sql.  Or maybe I just don't know the primary use of proc sql.

 

Basically, I wanted to know if I need to create multiple proc sqls or do all sql statements in proc sql.  For example, can I have any number of combination of create table/select statements inside one proc sql?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Yes, you can have multiple queries in one SQL Procedure

 

proc sql;
   create table class1 as
      select * from sashelp.class;
   create table class2 as
      select * from sashelp.class;
quit;

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

You can certainly have multiple queries in one PROC SQL

 

proc sql;
    create table a as select * from sashelp.class where age=14;
    create table b as select make,model,type,origin from sashelp.cars where
          mspr>40000 and horsepower>200;
quit;
--
Paige Miller
PeterClemmensen
Tourmaline | Level 20

Yes, you can have multiple queries in one SQL Procedure

 

proc sql;
   create table class1 as
      select * from sashelp.class;
   create table class2 as
      select * from sashelp.class;
quit;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 9733 views
  • 0 likes
  • 3 in conversation