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

Hi folks, 

 

I'd like to reconfigure and report the model output data in the form of a table shown below. Is it transpose problem or proc report problem? I'll appreciate your time and any suggestions. Direct help in the code would be helpful too. 

 

HELP_TABLE.png

DATA TRANS;
INPUT organs $ TYPE $  RR LCL UCL;
CARDS; 
eye  x1 1.05 1.04 1.06
eye  x2 1.04 1.02 1.06
head x1 1.09 1.08 1.10
head x2 1.22 1.20 1.24
hand x1 1.42 1.40 1.44
hand x2 1.23 1.02 1.24
; 

 what i tried and didn't work is following:

PROC SORT DATA=TRANS ;
BY ORGANS;
PROC TRANSPOSE DATA=TRANS OUT=TRANS1;
BY ORGANS;
VAR TYPE;
RUN; 
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

One way:

DATA TRANS;
INPUT organs $ TYPE $  RR LCL UCL;
CARDS; 
eye  x1 1.05 1.04 1.06
eye  x2 1.04 1.02 1.06
head x1 1.09 1.08 1.10
head x2 1.22 1.20 1.24
hand x1 1.42 1.40 1.44
hand x2 1.23 1.02 1.24
; 
run;
PROC SORT DATA=TRANS ;
BY ORGANS;
run;

proc report data=trans;
   columns organs type,(rr lcl ucl);
   define organs /group;
   define type /across;
run;

Your proc transpose code doesn't do anything with the rr lcl ucl so get discarded. I'm not quite sure what you were attempting with transpose. It won't create data sets with other variables nested within so you would still need to come up with something to display.

View solution in original post

8 REPLIES 8
ballardw
Super User

One way:

DATA TRANS;
INPUT organs $ TYPE $  RR LCL UCL;
CARDS; 
eye  x1 1.05 1.04 1.06
eye  x2 1.04 1.02 1.06
head x1 1.09 1.08 1.10
head x2 1.22 1.20 1.24
hand x1 1.42 1.40 1.44
hand x2 1.23 1.02 1.24
; 
run;
PROC SORT DATA=TRANS ;
BY ORGANS;
run;

proc report data=trans;
   columns organs type,(rr lcl ucl);
   define organs /group;
   define type /across;
run;

Your proc transpose code doesn't do anything with the rr lcl ucl so get discarded. I'm not quite sure what you were attempting with transpose. It won't create data sets with other variables nested within so you would still need to come up with something to display.

novinosrin
Tourmaline | Level 20

" Is it transpose problem or proc report problem?"

 

Do you want the output as dataset or report?

Cruise
Ammonite | Level 13
report
novinosrin
Tourmaline | Level 20

Well, in that case, no better than @ballardw 's sound help. 

Cruise
Ammonite | Level 13

It's amazing to have you all for support. How many creative projects would not have been born had you not been there for help? I really appreciate you guys! Real, applied knowledge is helping others to learn and keep motivated in their creativity. 

novinosrin
Tourmaline | Level 20

Likewise I learn a lot from your threads. Keep the questions coming! Have fun!

SuryaKiran
Meteorite | Level 14

You can also try PROC TABULATE,

 

proc tabulate data=work.have;
	var rr lcl ucl;
	class organs /	order=unformatted missing;
	class type /	order=unformatted missing;
	table organs,
		  type=' '*(rr*sum="" lcl*sum="" ucl*sum="");
run;
Thanks,
Suryakiran

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 8 replies
  • 1095 views
  • 6 likes
  • 5 in conversation