I am using a compute block in my proc report step to place headers above certain rows in my output. I want the text in the header to be underlined so I am using the style override textdecoration=underline. It is working fine except when the text I want to display is more than one word. In these cases, each word is underlined individually instead of one long continuous underline for the entire text block. The code I am using and resulting output are attached.
proc report data=longblhivchar1 nowd style={just=c rules=none frame=void cellspacing=0} contents=""
style(header)=[backgroundcolor=whtie color=black textdecoration=underline fontfamily="Arial" fontsize=26pt fontweight=bold just=c];
column group order stat count pct;
define stat / display ' '
style(column)={indent=0.5in cellwidth=5.75in cellheight=0.50in fontsize=22pt fontfamily="Arial"};
define group / order noprint;
define order / order noprint;
define count / display 'N'
style(column)={cellwidth=1.50in cellheight=0.50in fontsize=22pt fontfamily="Arial" just=c} ;
define pct / display '%'
style(column)={cellwidth=1.50in cellheight=0.50in fontsize=22pt fontfamily="Arial" just=c} ;
compute before group / style={just=l fontsize=26pt fontfamily="Arial" textdecoration=underline};
length text $ 50;
if group=1 then text='HIV risk';
else if group=2 then text=' ';
line text $50.;
endcomp;
run;
This only happens with PDF. Destinations RTF and HTML are fine.
You should report the bug to tech support.
In the meantime, you can replace the space with same sort of non-breaking space, like a tab.
ods pdf file="%sysfunc(pathname(WORK))\t.pdf";
proc report data=sashelp.class(obs=5) nowd ;
column sex age ;
define sex / order noprint;
define age / display ;
compute before sex / style={textdecoration=underline};
line 'HIV' '09'x 'risk' ;
line 'HIV risk' ;
endcomp;
run;
ods pdf close;
How would I incorporate that into my conditional logic compute block?
compute before group / style={just=l fontsize=26pt fontfamily="Arial" textdecoration=underline};
length text $ 50;
if group=1 then text="HIV '09'x risk";
else if group=2 then text=' ';
line text $50.;
endcomp;
Gotcha. Here is what I ended up with for future reference:
proc report data=longblhivchar1 nowd style={just=c rules=none frame=void cellspacing=0} contents=""
style(header)=[backgroundcolor=whtie color=black textdecoration=underline fontfamily="Arial" fontsize=26pt fontweight=bold just=c];
column group order stat count pct;
define stat / display ' '
style(column)={indent=0.5in cellwidth=5.75in cellheight=0.50in fontsize=22pt fontfamily="Arial"};
define group / order noprint;
define order / order noprint;
define count / display 'N'
style(column)={cellwidth=1.50in cellheight=0.50in fontsize=22pt fontfamily="Arial" just=c} ;
define pct / display '%'
style(column)={cellwidth=1.50in cellheight=0.50in fontsize=22pt fontfamily="Arial" just=c} ;
compute before group / style={just=l fontsize=26pt fontfamily="Arial" textdecoration=underline};
length text $ 50;
if group=1 then text='HIV'||'09'x||'risk';
else if group=2 then text=' ';
line text $50.;
endcomp;
run;
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.