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

 

Hello,

 

Can anyone help me with proc transpose . I would like to use PROC Transpose procedure for following output.

 

trans.PNG

My desire output is as follow. Can someone explain me with PROC transpose code. how do i get my desire output.

proc transpose data=lll;
		by trt;
		id order;
		var count;
		run;

I use this code but not able to get desire output

output.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Think of ID as the column identifiers and BY as the row identifiers. You have yours backwards.

 


@unnati wrote:

 

Hello,

 

Can anyone help me with proc transpose . I would like to use PROC Transpose procedure for following output.

 

trans.PNG

My desire output is as follow. Can someone explain me with PROC transpose code. how do i get my desire output.

proc transpose data=lll;
		by trt;
		id order;
		var count;
		run;

I use this code but not able to get desire output

output.PNG

 


 

View solution in original post

2 REPLIES 2
Reeza
Super User

Think of ID as the column identifiers and BY as the row identifiers. You have yours backwards.

 


@unnati wrote:

 

Hello,

 

Can anyone help me with proc transpose . I would like to use PROC Transpose procedure for following output.

 

trans.PNG

My desire output is as follow. Can someone explain me with PROC transpose code. how do i get my desire output.

proc transpose data=lll;
		by trt;
		id order;
		var count;
		run;

I use this code but not able to get desire output

output.PNG

 


 

ballardw
Super User

We can't write code from pictures.

Provide you example input data in the form of a data step.

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

Do you want a report, read by people, or a data set to send to another procedure?

 

The output below looks suspiciously like the output of a SAS report procedure. Such as

proc tabulate data=lll;

   class trt order;

   freq count;

   tables order, trt

   ;

run;


@unnati wrote:

 

output.PNG

 


 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 789 views
  • 0 likes
  • 3 in conversation