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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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