BookmarkSubscribeRSS Feed
taishayla
Calcite | Level 5

Hello,

 

I am trying to determine the best way to handle programming for a clinical data set I have. Below is a simplified view of the current structure of the data I have. What I want is a transposed version of it. The reason I haven't been able to figure out how to transpose it is because a client can have multiple assessments at the 'PRN' timepoint. For similar data, I have been able to output separate datasets based on timepoints and then merge them back together (which worked well because there was one assessment per timepoint - no 'PRN'). I also am not sure how to best handle var1-4 (these are 4 variables that are for each assessment) - which has also made this difficult. There should be one row per unique ClientID. In addition to this, I would like to (eventually) be able to bring the dataset in SAS and update a master existing SAS dataset (based on the desired structure) when a new ClientID is detected OR there is a new survey for an existing client. Any insight would be greatly appreciated. 

 

Current Structure:

ClientIDtimepointsurveydatetotalscorevar1var2var3var4
15th-7th Pregnancy Visit6/1/20221Yesnoyesyes
112 Weeks Postpartum6/2/20222Yesnoyesyes
1Child 16 Months6/3/20223Yesnoyesyes
1prn6/4/20227Yesnoyesyes
1prn6/5/20228Yesnoyesyes
25th-7th Pregnancy Visit6/6/20228Yesnoyesyes
2Child 16 Months6/7/20229Yesnoyesyes

 

Desired Structure:

Clientidtimepoint1surveydate1totalscorevar1var2var3var4timepoint2surveydate2totalscore2var1var2var3var4timepoint3surveydate3totalscore3var1var2var3var4timepoint4surveydate3totalscore4var1var2var3var4timepoint5surveydate5totalscore5var1var2var3var4
15th-7th Pregnancy Visit6/1/20221Yesnoyesyes12 Weeks Postpartum6/2/20222YesnoyesyesChild 16 Months6/3/20223Yesnoyesyesprn6/4/20227Yesnoyesyesprn6/5/20228Yesnoyesyes
25th-7th Pregnancy Visit6/6/20228YesnoyesyesChild 16 Months6/7/20229Yesnoyesyes                     
4 REPLIES 4
ballardw
Super User

The real question is what do you expect to do with the wide version that you cannot do with the current version.

taishayla
Calcite | Level 5
I want to be able to see one observation per unique clientID.
andreas_lds
Jade | Level 19

It is impossible to create the structure you want, because each variable name has to be unique.

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
  • 4 replies
  • 1174 views
  • 1 like
  • 4 in conversation