BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SannaSanna
Quartz | Level 8

Hello! 

 

I am trying to transpose a large table with array columns into rows.  I would appreciate help!  Thank you in advance! 

 

The data looks like this: 

ID1 Term1 Term2 Term3 Term4 Term5 Term6
a_78076 7600 7600 9875 4388 3709  
er_866455 5436 9468 4009 4388 7600 3288

 

I need to create individual rows for each of the Term1-6 for each ID.  

Results to look like this: 

ID1 Term
a_78076 7600
a_78076 7600
a_78076 9875
a_78076 4388
a_78076 3709
er_866455 5436
er_866455 9468
er_866455 4009
er_866455 4388
er_866455 7600
er_866455 3288

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
data Want;
 set have;
 array t term1-term6;
 do over t;
  term=t;
  if term then output;
end;
keep id term;
run;

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20
data Want;
 set have;
 array t term1-term6;
 do over t;
  term=t;
  if term then output;
end;
keep id term;
run;
SannaSanna
Quartz | Level 8
Thank you so very much- I've been coding and re-coding Proc Transpose to get this to work, but this produced the exact results I need. Thank you again!!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 677 views
  • 0 likes
  • 2 in conversation