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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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