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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ghosh
Barite | Level 11
data master2;
merge master(drop=napcs) updates;
by CPI;
run;

proc print; run;

ghosh_0-1657589182224.png

 

View solution in original post

1 REPLY 1
ghosh
Barite | Level 11
data master2;
merge master(drop=napcs) updates;
by CPI;
run;

proc print; run;

ghosh_0-1657589182224.png

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 292 views
  • 1 like
  • 2 in conversation