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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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