HI, I have a table like below and want it to be transposed like the "WANT" table below. Please suggest.
| HAVE | ||||||
| number | RG | LB | PM | AR | VL | JB |
| 9001 | x | a | b | a | x | b |
| 9002 | x | a | b | a | x | b |
| 9003 | x | x | x | x | y | x |
| 9004 | y | x | x | x | a | x |
| WANT | ||||||
| number | seq | value | ||||
| 9001 | RG | x | ||||
| 9001 | LB | a | ||||
| 9001 | PM | b | ||||
| 9001 | AR | a | ||||
| 9001 | VL | x | ||||
| 9001 | JB | b | ||||
| 9002 | RG | x | ||||
| 9002 | LB | a | ||||
| 9002 | PM | b | ||||
| 9002 | AR | a | ||||
| 9002 | VL | x | ||||
| 9002 | JB | b | ||||
| 9003 | RG | x | ||||
| 9003 | LB | x | ||||
| 9003 | PM | x | ||||
| 9003 | AR | x | ||||
| 9003 | VL | y | ||||
| 9003 | JB | x | ||||
| 9004 | RG | y | ||||
| 9004 | LB | x | ||||
| 9004 | PM | x | ||||
| 9004 | AR | x | ||||
| 9004 | VL | a | ||||
| 9004 | JB | x |
Proc transpose makes that an easy task. e.g.:
proc transpose data=have out=want (rename=(_name_=seq col1=value)); var rg--jb; by number notsorted; run;
HTH,
Art, CEO, AnalystFinder.com
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.