Dear All:
May I ask how to transform the following have table to the want table right below?
HAVE table:
patient | tcell_[year1] | tcell_[year2] | tcell_[year3] | tcell_[year4] | tcell_[year5] |
---|---|---|---|---|---|
A | 23 | 34 | 213 | 45 | 435 |
C | 132 | 213 | 123 | 345 | 435 |
D | 13 | 123 | 123 | 435 | 123 |
E | 343 | 1231 | 4325 | 435 | 345 |
WANT table:
patient | year | tcell |
---|---|---|
A | 1 | 23 |
A | 2 | 34 |
A | 3 | 213 |
A | 4 | 45 |
A | 5 | 435 |
C | 1 | 132 |
C | 2 | 213 |
C | 3 | 123 |
D | 1 | 13 |
D | 2 | 123 |
D | 3 | 123 |
Use Proc Transpose:
SAS Learning Module: How to reshape data wide to long using proc transpose
Thank you so much, this work!
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.