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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 801 views
  • 0 likes
  • 3 in conversation