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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.