BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
create table pd_pool_id_mob_le_6_l0_pre as
     select
           a.account_no
           a.level4,
           a.level3
from
           monthly.pd_pool_id_&&yymmdd_L0 a,
           staging.credit_card_account_h_&&yymmdd_L0 b
where
           a.account_no=b.account_no and
           intck('month', date_card_opened, "&SAMPDATE"d)+1<=7;

what does it mean to select from more than one dataset?

is this an inner join?

3 REPLIES 3
PaigeMiller
Diamond | Level 26
In this case, the code is performing a Cartesian join of the two data sets. Examples and further explanation here: https://sasnrd.com/sas-cartesian-product-proc-sql-data-step/
--
Paige Miller
Tom
Super User Tom
Super User

You are JOINing the two datasets. (kind of like a MERGE in normal SAS code, but more complicated).

 

In this case since you are testing if the account numbers match between the two datasets it is like an INNER JOIN.

 

So you are taking three variables from the "monthly" dataset, but only for the account numbers that are also in the "staging" dataset.  You are also filtering on the DATE_CARD_OPENED variable, but the code does not tell us which of two datasets has that variable. (if both have the variable the code will fail for being ambiguous).

gema
Calcite | Level 5
you are really only selecting from first dataset if account_no on is in both data sets (inner join) and date criteria is met

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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