BookmarkSubscribeRSS Feed
Div_sas
Calcite | Level 5

Hi,

 

I have two datasets, one has 100 subject IDs and the other has 100 Blind ids, is there a way to randomly merge/match these two datasets so that each subject ID gets a blind id assigned to it

 

I have:

dataset 1:

blind id
1-119
1-123
1-102
1-155

dataset2:

subject ID

122
234
345
566

 I want:

subject IDblind id
1221-123
2341-155
3451-119
5661-102

Thank you.

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20
data dataset1;
input blindid $;
datalines;
1-119
1-123
1-102
1-155
;

data dataset2;
input subjectID;
datalines;
122
234
345
566
;

data help;
   set dataset1;
   x=rand('Uniform');
run;

proc sort data=help;
   by x;
run;

data want(drop=x);
   merge dataset2 help;
run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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