I have proc report code that writes to an rtf file. The bottom border is supposed to be double and the Word properties show it as double but it does not display as double. Any advice welcome - thanks!
filename outfile "P:\myfile.rtf";
data report;
length col0-col3 rowstyle $60;
col0="Gender (N, %)"; col1=" "; col2=" "; col3=" "; rowstyle=" BOLD"; output;
col0=" Female"; col1=" 196 (29.6%)"; col2=" 18 (36.0%)"; col3=" 214 (30.1%)"; rowstyle=" "; output;
col0=" Male"; col1=" 466 (70.4%)"; col2=" 32 (64.0%)"; col3=" 498 (69.9%)"; rowstyle=" DOUBLE"; output;
run;
ods listing close;
ods rtf bodytitle file = outfile;
ods escapechar = "|";
title1 "|S={indent=0in font=('TIMES NEW ROMAN',11pt,bold)}Table 2A: Subject Demographics";
proc report data=Report nowd missing wrap
style(header)= {background=white
bordertopstyle=double
borderbottomstyle=double
font=("TIMES NEW ROMAN",10pt,bold)}
style(column)= { font=("TIMES NEW ROMAN",10pt,normal) } ;
columns (col0) (col1-col3 ) rowstyle;
define col0 / display left flow "Subject Characteristics|S={borderleftstyle=double}" style={cellwidth=3.5in asis=on textalign=l verticalalign=t};
define col1 / display center "Subjects in |n On Arm |n(N = 662)" style={cellwidth=1.0in};
define col2 / display center "Subjects in |n Off Arm |n(N = 50)" style={cellwidth=1.0in};
define col3 / display center "Total |n Subjects |n(N = 712) |S={borderrightstyle=double}" style={cellwidth=1.0in};
define rowstyle / noprint;
compute col0;
call define("col0","Style","STYLE=[borderleftstyle=double]");
endcomp;
compute col3 ;
call define("col3 ","Style","STYLE=[borderrightstyle=double]");
endcomp;
compute rowstyle;
if index(rowstyle,'BOLD') gt 0 then do;
if index(rowstyle,'UNDERLINE') eq 0 then do;
call define(_row_,"Style", "STYLE=[fontweight=bold borderbottomstyle=hidden]");
end;
else if index(rowstyle,'DOUBLE') gt 0 then do;
call define(_row_,"Style", "STYLE=[fontweight=bold borderbottomstyle=double]");
end;
else do;
call define(_row_,"Style", "STYLE=[fontweight=bold]");
end;
end;
else if index(rowstyle,'UNDERLINE') eq 0 then do;
call define(_row_,"Style", "STYLE=[borderbottomstyle=hidden]");
end;
else if index(rowstyle,'DOUBLE') gt 0 then do;
call define(_row_,"Style", "STYLE=[borderbottomstyle=double]");
end;
endcomp;
run;
ods rtf close;
ods listing;
Figured it out. It did not like my 'rowstyle' compute block. I replaced it with this and now I get what I wanted.
if index(rowstyle,'DOUBLE') gt 0 and index(rowstyle,'BOLD') gt 0 then call define(_row_,"Style", "STYLE=[borderbottomstyle=double fontweight=bold]");
else if index(rowstyle,'DOUBLE') gt 0 then call define(_row_,"Style", "STYLE=[borderbottomstyle=double fontweight=normal]");
else if index(rowstyle,'BOLD') gt 0 then call define(_row_,"Style", "STYLE=[borderbottomstyle=hidden fontweight=bold]");
else call define(_row_,"Style", "STYLE=[borderbottomstyle=hidden fontweight=normal]");
So close. I can't see how to update my original post. In simplifying the code for upload I missed one thing.
col0=" Male"; col1=" 466 (70.4%)"; col2=" 32 (64.0%)"; col3=" 498 (69.9%)"; rowstyle=" UNDERLINE"; output;
should be
col0=" Male"; col1=" 466 (70.4%)"; col2=" 32 (64.0%)"; col3=" 498 (69.9%)"; rowstyle=" DOUBLE"; output;
@debusb1 wrote:
So close. I can't see how to update my original post.
Your message should show 3 vertical dots next to the title. Right click on them and you should have a menu that allows edit the post (or delete or a number of other actions).
Figured it out. It did not like my 'rowstyle' compute block. I replaced it with this and now I get what I wanted.
if index(rowstyle,'DOUBLE') gt 0 and index(rowstyle,'BOLD') gt 0 then call define(_row_,"Style", "STYLE=[borderbottomstyle=double fontweight=bold]");
else if index(rowstyle,'DOUBLE') gt 0 then call define(_row_,"Style", "STYLE=[borderbottomstyle=double fontweight=normal]");
else if index(rowstyle,'BOLD') gt 0 then call define(_row_,"Style", "STYLE=[borderbottomstyle=hidden fontweight=bold]");
else call define(_row_,"Style", "STYLE=[borderbottomstyle=hidden fontweight=normal]");
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: