BookmarkSubscribeRSS Feed
kippy_kips
Calcite | Level 5

I have two data sets WORK and SUMS. WORK is my working data set and SUMS is half the size and contains the same exact IDs as WORK. SUMS has the variables I want for the observations I was analyzing, so I want to merge the data sets and replace the observations in WORK with those in SUMS.

Example of a small portion what they look like:

WORK

SEQNalcohollegumesmeat
100011.53.02.3
100021.42.33.5
1000305.02.3
100043.02.02.0

SUMS

SEQNalcohollegumesmeat
100022.23.35.0
100045.53.82.2

So the observations in the SUMS would replace the existing ones in WORK.

Thanks for your time!

1 REPLY 1
Reeza
Super User

A straight merge will do this if the variable names are the same as in your example.

 

data want;
merge work sums;
by SEQN;
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 289 views
  • 0 likes
  • 2 in conversation