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

 


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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