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)
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.