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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.