BookmarkSubscribeRSS Feed
mariamon0
Fluorite | Level 6

I have an id variable in one study that is numeric

and a study_id variable in another study that is a character.

How do I harmonize these so that study_id=id as well as change them from character to numeric.

5 REPLIES 5
Kurt_Bremser
Super User

ID variables are not used for calculations, so store them as character.

Please supply examples for your character ID data, then we can show you how to convert the numbers to that.

mariamon0
Fluorite | Level 6

the id= 23434 just a number

the pid= 23423 is also just a number

study_id is BOM234 letters and numbers

I am trying to sort by just study_id

I want id and pid to be be renamed as study_id

mariamon0
Fluorite | Level 6

 ID belongs to study 1

pid belongs to study 2

and study_id belongs to study 3

I am trying to combine information from all three studies.

but want one variable called study id to know who all the participants are

Kurt_Bremser
Super User

Is it important to know if a single person took part in more than one study? If yes, how can you correlate the entries?

If no, just format your purely numeric IDs (if they are actually stored in numeric variables in SAS) with z6. (to get an even length).

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
  • 5 replies
  • 534 views
  • 0 likes
  • 2 in conversation