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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.