flyfishin4trout
asked on
SAS Rows to Columns
I need to do the following in "SAS" (Also the number of Meds will vary. So there might be 3, 10, 20, etc)
Take the example dataset from
ID Med
1 A
1 B
1 C
2 D
3 A
3 C
To
ID Med_1 Med_2 Med_3
1 A B C
2 D
3 A C
Thanks,
J
Take the example dataset from
ID Med
1 A
1 B
1 C
2 D
3 A
3 C
To
ID Med_1 Med_2 Med_3
1 A B C
2 D
3 A C
Thanks,
J
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Proc transpose is definitely what he needed as was my suggestion.
Here is the answer. Its simple code and exact solution to your problem. It creates "mid_" columns based on the values of ID column. If ID column has 10 unique values then there will be 10 "mid_" variables in the result dataset.
Regards
Kumar
Open in new window