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)
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.
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.