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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 8 replies
  • 1476 views
  • 6 likes
  • 5 in conversation