I used the following two methods and found out there is difference in number of records for each method:
data x;
merge SASDATA.TU_LAIDC_APAC(in=a) SASDATA.TU_LAIDC_APAC_corp(in=b);
by id;
if a or b;
run;
The above results in 154718 records.
when I use the following:
proc sql;
create table xx as
select coalesce(a.id,b.id) as id
from SASDATA.TU_LAIDC_APAC a full outer join SASDATA.TU_LAIDC_APAC_corp b
on a.id=b.id;
quit;
This one results in 155047 records.
where could be the difference?
you probably have some id va.uess with 2 or more rows in both datasets. suppose you have id=99 twice in both datasets - SQL will form the cartesian join of these (4 output records). datastep will advance each by group until the end of the shorter one, and then hold that row until the end of the longer one (2 output records)
you probably have some id va.uess with 2 or more rows in both datasets. suppose you have id=99 twice in both datasets - SQL will form the cartesian join of these (4 output records). datastep will advance each by group until the end of the shorter one, and then hold that row until the end of the longer one (2 output records)
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.
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.