I have the following table:
| ID | Type | Ratio |
| 4106 | CR | 1.4 |
| 4106 | IC | 2 |
| 4812 | CR | 1.3 |
| 5287 | IC | 5 |
| 7011 | CR | 1 |
| 7011 | IC | 1.5 |
| 7011 | TNW | 2.5 |
| 7849 | FC | 0.6 |
| 10261 | FC | 1 |
| 11057 | TNW | 0.75 |
| 11178 | CR | 1.5 |
| 11178 | IC | 3.75 |
| 11178 | TNW | 1.1 |
| 11452 | FC | 1.75 |
How do I summarize the data so I have one row per ID (want table).
| ID | CR | IC | TNW | FC |
| 4106 | 1.4 | 2 | ||
| 4812 | 1.3 | |||
| 5287 | 5 | |||
| 7011 | 1 | 1.5 | 2.5 | |
| 7849 | 0.6 | |||
| 10261 | 1 | |||
| 11057 | 0.75 | |||
| 11178 | 1.5 | 3.75 | 1.1 | |
| 11452 | 1.75 |
Do you need to do it using proc sql? Proc transpose was made for such tasks:
proc transpose data=have out=want (drop=_:);
by id;
id type;
var ratio;
run;
HTH,
Art, CEO, AnalystFinder.com
Do you need to do it using proc sql? Proc transpose was made for such tasks:
proc transpose data=have out=want (drop=_:);
by id;
id type;
var ratio;
run;
HTH,
Art, CEO, AnalystFinder.com
Thank you art.
CFC_SAS_Communities_400x225.jpg
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.