BookmarkSubscribeRSS Feed
Oversea_rep
Calcite | Level 5

Hi,

I have a dataset with multiple variables for different cohorts. The dataset contains date of birth variable, sex, race and vaccine dates from 3 follow-up periods and therefore three cohorts. I would like to consolidate the demographic variables for all subjects from the different cohorts in the dataset into one single demographic variable for sex, gender, dob, vaccine date, etc.

 

Note: some subjects belong to more than one cohort. They were re-enrolled for follow-up.

 

Edit: I added the remaining variables to the table. Race/ethnicity and gender are categorical variables.

 

Example of the dataset:

Studyidcohort1_dobcohort2_dobcohort3_dobRace/ethnicity cohort1Race/ethnicity cohort 2Race/ethnicity cohort 3Gender cohort 1Gender cohort 2Gender cohort 3cohort1_vaxdatecohort2_vaxdatecohort3_vaxdate
001..12/31/1990..1..5..14/06/2005
00210/05/1998..1..1..15/06/2004..
00302/01/1994.02/01/19942.23.323/07/2009.16/03/2021
00403/04/198903/04/1989.11.11.16/05/200608/08/2013 
005.04/05/2009..2..1. 14/04/2008 
00605/07/2008.05/07/20081.13.304/12/2012.17/06/2017
1 REPLY 1
andreas_lds
Jade | Level 19

I don't see any of the variables you mention in the table you have posted, so please post the data in usable form and include all variables that are in the dataset. Merging variables is almost always a bad idea, because it will be more difficult to use the new variable to filter the data.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 762 views
  • 0 likes
  • 2 in conversation