BookmarkSubscribeRSS Feed
helloSAS
Obsidian | Level 7

can i write the below two steps in one step?

proc sql;
create table tempexclusion as
select b.*
from acc as a
    right join prep as b
          on a.tlnbr = b.phone
    where a.tlnbr is not null;
quit;


proc sql UNDO_POLICY=NONE;
create table prep as
select b.*
from acc as a
    right join prep as b
          on a.tlnbr = b.phone
    where a.tlnbr is null;
quit;

6 REPLIES 6
LinusH
Tourmaline | Level 20

I may be somewhat blind, but what is the difference between the two steps (a part from different target table names)???

If the question is if you can create multiple table in one SQL statement, so, no, not in SAS.

Data never sleeps
LinusH
Tourmaline | Level 20

Oh, no I see, not is a small word...

Well, I guess you just need to remove the where clause. Or what is you want?

Data never sleeps
PGStats
Opal | Level 21

If you mean to call proc SQL only once, you can use the reset statement :

proc sql;
create table tempexclusion as
select b.*
from acc as a
    right join prep as b
          on a.tlnbr = b.phone
    where a.tlnbr is not null;
RESET UNDO_POLICY=NONE;
create table prep as
select b.*
from acc as a
    right join prep as b
          on a.tlnbr = b.phone
    where a.tlnbr is null;
quit;

PG

PG
helloSAS
Obsidian | Level 7

is the reset option better in terms of efficiency or run time? or am i just reducing few lines of code?

thanks for the reply

PGStats
Opal | Level 21

There must be a small efficiency gain but I doubt you will ever notice the difference. - PG

PG
helloSAS
Obsidian | Level 7

thank you

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1608 views
  • 6 likes
  • 3 in conversation