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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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