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

I need to join all the variables in one dataset (caper10.caperfy10_selectvar; 17,407,272 obs) with specified variables in a 2nd dataset (temp1.fy1011_pnpts_enddate; 62,451 obs and no duplicates). I've done this with multiple tables and have never lost observations, but this time the joined dataset has 16,4999,282 obs.

 

My syntax is:

 

proc sql;
    create table left_outer_join as
       select *
          from caper10.caperfy10_selectvar as a left join
              temp1.fy1011_pnpts_enddate (keep = patssn paindate pnid enddate diag patssn1) as b
             on a.sponssn = b.patssn;
quit;

 

Both sponssn and patssn are character variables.

 

Any insight into why this is happening will be greatly appreciated!

 

I'm using SAS 9.4, 64 bit.

 

Thanks!

 

Janet

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

As far as I can tell, this should not append. How did you get the number of obs in caper10.caperfy10_selectvar? One possible explanation: Some (most, all?) databases do not remove deleted obs, they only mark them as "deleted". SAS is no exception. The count of records in a data table given by dictionary.tables field nobs can be superior to the count of logical records (nlobs) because some records have been deleted.

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

As far as I can tell, this should not append. How did you get the number of obs in caper10.caperfy10_selectvar? One possible explanation: Some (most, all?) databases do not remove deleted obs, they only mark them as "deleted". SAS is no exception. The count of records in a data table given by dictionary.tables field nobs can be superior to the count of logical records (nlobs) because some records have been deleted.

PG
janet0102
Calcite | Level 5

Thanks! I ran a proc contents and got the smaller number. I'd gotten the larger number in the log after a proc sort.

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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