Hello I hope you are all well.
I have IDs, such AB124008 in which AB = site of enrollment, 12, represents MD id, and 40008 represents the actual patient id in the study.
I looked through all of Cody's books, or most, and know that I probably am missing something.
They are all character / text variables.
How do I separate all the IDs into:
1) site of enrollment - want it to be a text var
2) physician code - want to it to be a number
3) actual id - want to be a number
Thanks!
I have many enrolled patients in the study. I know there has to be an array to separate them.
is your question complete? Meaning do all your obs follow the same pattern for extraction? If yes,
data w;
k='AB124008';
siteofenrollment=substr(k,1,2);
physiciancode=input(substr(k,3,2),8.);
actualid=input(substr(k,5),8.);
run;
is your question complete? Meaning do all your obs follow the same pattern for extraction? If yes,
data w;
k='AB124008';
siteofenrollment=substr(k,1,2);
physiciancode=input(substr(k,3,2),8.);
actualid=input(substr(k,5),8.);
run;
Thank you so much!!!!
@mgrzyb wrote:
Hello I hope you are all well.
I have IDs, such AB124008 in which AB = site of enrollment, 12, represents MD id, and 40008 represents the actual patient id in the study.
I looked through all of Cody's books, or most, and know that I probably am missing something.
They are all character / text variables.
How do I separate all the IDs into:
1) site of enrollment - want it to be a text var
2) physician code - want to it to be a number
3) actual id - want to be a number
Thanks!
I have many enrolled patients in the study. I know there has to be an array to separate them.
What arithmetic are you performing on physician code and actual id? If none, why a number?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.