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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 575 views
  • 0 likes
  • 2 in conversation