Hi.
I run into some trouble.
I have the data in the following long format.
PID 1 - Drug A
PID 1 - Drug B
PID 1 - Drug A
PID 1 - Drug C
PID 2 - Drug B
PID 2 - Drug C
PID 2 - Drug C
There are duplicates and I would like to transform it into wide format like this.
PID 1 = Drug A Drug B Drug C
PID 2 = Drug B Drug C
I tried to use nodupkeys but if I did that, PID 1 would only have Drug A and it would delete the other 2.
Thanks !
PID Drug
1 A
1 B
1 A
1 C
2 B
2 C
2 C
1. What are the variables in the before and after data?
Provide as a data step please.
2. This change will probably make the data harder to use later on.
Thanks. It works now.
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.