data rawdata ;
input id $ test $ result ;
cards;
101 bp 120
101 wbc 230
101 rbc 234
102 bp 120
102 wbc 230
102 rbc 234
run;
Note: we need to transpose the data in proc report only
ods rtf file="path" ;
proc report data=rawdata ;
column id test result ;
define test/across ;
define id/order ;
run;
ods rtf close ;
output should be like:
Analysis Variables
----------------------------------
id bp wbc rbc
101 120 230 234
102 120 230 234
my question is how to apply extra label for all test varibles "Analysis Variables" while transposing
Note: We should do in proc report only (don't use proc tranpose)
define test/across "Analysis Variables";
data rawdata ; input id $ test $ result ; cards; 101 bp 120 101 wbc 230 101 rbc 234 102 bp 120 102 wbc 230 102 rbc 234 ; run; ods rtf file="c:\temp\temp.rtf" style=journal bodytitle; ods escapechar = '^'; proc report data=rawdata split='*' nowd; column id result,test ; define test/across "^R/RTF'\brdrb\brdrs 'Analysis Variables"; define result/analysis ' '; define id/group ; run; ods rtf close ;
Hi:
As an alternative, this is also possible with a style override instead of RTF control strings. This means the technique would work in other destinations, not just RTF:
Cynthia
how to apply label for only 2 columns like :
Analysis Variable
----------------------------
id bp rbc rbc
101 120 230 340
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.