New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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