BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mgrzyb
Quartz | Level 8

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.  

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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;

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

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;
mgrzyb
Quartz | Level 8

Thank you so much!!!!

ballardw
Super User

@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?

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
  • 3 replies
  • 913 views
  • 0 likes
  • 3 in conversation