I have dataset with patients' IDs numbered in no sequential way. I want to make change to all the IDs.
For example patient 002 would be after the change: F1-1-KIDN-002.
It is just adding "F1-1-KIDN-" in front of the original ID.
I give an example of how the data looks like.
Thank you
id,C1,C2,C3,C4
002,4.19855,5.74574,33.46678,6.85391
007,3.48004,6.69138,31.85662,11.73753
009,3.33851,5.74293,36.09064,10.9801
020,3.2966,8.15718,30.27008,7.62836
data want;
set have (rename=(id=_id));
length id $13;
id = "F1-1-KIDN-" !! put(_id,z3.);
drop _id;
run;
Is id currently stored as numeric or character?
Posting example data in a data step with datalines would have made this question unnecessary.
Numeric
data want;
set have (rename=(id=_id));
length id $13;
id = "F1-1-KIDN-" !! put(_id,z3.);
drop _id;
run;
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!
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.
Ready to level-up your skills? Choose your own adventure.