DATA Step, Macro, Functions and more

how to transpose selected data lines from row to column

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 129
Accepted Solution

how to transpose selected data lines from row to column

Hi,

 

I want to transpose some of the data lines from row to column... something like this

 

SAS - Transpose.PNG

 

 

 

please advise how to achieve it

 

Thanks


Accepted Solutions
Solution
‎06-22-2017 03:41 PM
Trusted Advisor
Posts: 1,128

Re: how to transpose selected data lines from row to column

Please use transpose , you may need to sort the dataset before on city_id and city

 

proc transpose data=have out=want;
by city_id city;
id category;
var count;
run;
Thanks,
Jag

View solution in original post


All Replies
Solution
‎06-22-2017 03:41 PM
Trusted Advisor
Posts: 1,128

Re: how to transpose selected data lines from row to column

Please use transpose , you may need to sort the dataset before on city_id and city

 

proc transpose data=have out=want;
by city_id city;
id category;
var count;
run;
Thanks,
Jag
Super User
Posts: 17,819

Re: how to transpose selected data lines from row to column

[ Edited ]

You said 'some' but your example shows all records being transposed. 

 

Edit: https://communities.sas.com/t5/General-SAS-Programming/Proc-Transpose/m-p/86307/highlight/true#M2724...

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 104 views
  • 1 like
  • 3 in conversation