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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 961 views
  • 0 likes
  • 2 in conversation