Hello, I'm trying a simple many-to-one merge but I'm getting weird results.
In the program below, I want to replace 6 & 8 by 3, and 4 & 7 by 5. However, only the 6 and 4 are being replaced. Any ideas?
data master;
input CPI NAPCS;
cards;
1 6
1 8
2 4
2 7
;
data updates;
input CPI NAPCS;
cards;
1 3
2 5
;
data master2;
merge master updates;
by CPI;
run;
Please, no SQL suggestions.
data master2;
merge master(drop=napcs) updates;
by CPI;
run;
proc print; run;
data master2;
merge master(drop=napcs) updates;
by CPI;
run;
proc print; run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.