Good day
I am trying to align my values of the circled column on the picture below, please advise. I have attached an example of an output with proper aligned values. I have also attached a code to be used as an example to use:
data class;
set sashelp.class;
height = height+.8;
weight = weight+.9;
if name in('Alfred' 'Carol' 'James')
then do;
height = 88.88;
weight =77.77;
end;
if age=14 then count_percent=strip(put(height,6.))||'(12.13)';
else if age=13 then count_percent=strip(put(height,6.))||'(89.3)';
else count_percent=strip(put(height,6.))||'(100.00)';
run;
ods listing close;
title; footnote;
ods tagsets.RTF file='C:\Users\just_d.rtf';
proc report data=class nowd headline headskip split='~' missing style ( report )=[frame=hsides outputwidth = 10in background = white
font_face='Courier New' font_size=3]
style(column)={just=CENTER font_face='Courier New' background=white foreground=black
font_size=3 cellwidth=.6in}
style(header)={just=center font_face='Courier New' cellheight=.8in font_size=3
foreground=black cellwidth=.6in
background=white font_style=roman vjust=t} ;
column name age height weight weight=wt2 count_percent;
define height / 'ht Just=c'
style(column)={just=c};
define weight / 'wt just=d'
style(column)={just=d};
define wt2 / 'wt just=d/chg margin'
style(column)={just=d width=1.0in rightmargin=.25in};
define count_percent / 'wt just=d/chg margin'
style(column)={just=d width=1.0in rightmargin=.25in};
run;
ods _all_ close;
on the final report or output i wish the values to align like the example below:
proc freq data=sashelp.heart noprint; table Smoking_Status/out=temp; run; data want; set temp; length c_count $ 8 c_per $ 5; c_count=put(count, 8. -r); c_per=put(percent, 4.1 -r); value=c_count||' ('||c_per||')'; if not missing(Smoking_Status); run; ods rtf file='c:\temp\x.rtf'; proc report data=want nowd style(report)={ outputwidth=100%}; define value/display style={just=right font_face=arial}; run; ods rtf close;
proc freq data=sashelp.heart noprint; table Smoking_Status/out=temp; run; data want; set temp; length c_count $ 8 c_per $ 5; c_count=put(count, 8. -r); c_per=put(percent, 4.1 -r); value=c_count||' ('||c_per||')'; if not missing(Smoking_Status); run; ods rtf file='c:\temp\x.rtf'; proc report data=want nowd style(report)={ outputwidth=100%}; define value/display style={just=right font_face=arial}; run; ods rtf close;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.