I'm creating a PDF with ODS PDF statements, and it's beautiful, except for one small region. It's just a few lines of text (using ODS TEXT statements) -- but I'd like to draw a solid black border around it. I haven't been able to make the left border appear as a solid black line, because the text overwrites it. (Top, bottom and right borders are all solid black lines - great!) I've tried using marginleft= and asis=on and cellpadding=, and nothing seems to work.
Any ideas?
My code is this:
ods region x=0in y=9in width=8in height=0.75in
style={borderwidth=1pt bordercolor=black};
ods text = " "; * So top border is not overwritten by text;
ods text = "^S={marginleft=8pt}NOTE: Overall totals ....";
ods text = " ";
ods text = "^S={asis=on} *Leading causes of injury ... ";
ods text = "^S={asis=on} morbidity. See Appendices ...";
and output is below:
Hi:
Do you want to change the STYLE template that you use with this report? If so, then the USERTEXT style element changes the attributes for ODS TEXT strings. Here's an example:
I had to fiddle with the height of the region. so that the y and the p did not encroach on the bottom border. I also changed the color to red in the template, so you could be sure that the template was being used for the ODS TEXT strings. Since I had the template in play, I took out the ASIS=ON and other attributes.
Cynthia
Hi:
We need to see ALL your code, including the ODS PDF statements. Typically, the background of ODS PDF output is white, so it appears that you might be using a different style to get a gray background in your output.
To change the style of ODS TEXT to match the style you're using for the report, you have to change the USERTEXT style element in the STYLE template.
Cynthia
Cynthia,
Thanks for the response. I didn't include the entire code because I didn't think it was relevant, and the background is shaded gray because while I'm writing the SAS code the first time, I find it helpful to set a background color other than white to help verify that I have correctly assigned the dimensions to each region. Then I remove the background color.
Here's the rest of the ODS PDF code, leaving out other regions on the page that work OK ...
options orientation=portrait papersize=letter
topmargin=0.001in bottommargin=0.001in leftmargin=0.25in rightmargin=0.25in;
ods pdf file='H:\test.pdf' notoc style=HTMLBlue startpage=no;
ods escapechar='^';
**************************************** P A G E O N E *************************************************************************;
ods layout start
x=0in y=0in
/*style={background=lightgray}*/;
..... lots of region statements with PROC REPORT statements here;
ods region x=0in y=9in width=8in height=0.75in
style={borderwidth=1pt bordercolor=black};
ods text = " "; * So top border is not overwritten by text;
ods text = "^S={marginleft=8pt}NOTE: Overall totals ....";
ods text = " ";
ods text = "^S={asis=on} *Leading causes of injury ... ";
ods text = "^S={asis=on} morbidity. See Appendices ...";
ods layout end;
ods pdf close;
I found an alternate solution -- I decided to center each of the ODS TEXT lines in this region (by adding just=c to each text's style). That moves the beginning of each text line sufficiently right of the left-side border, so the text doesn't "overwrite" the left border line, like this:
ods text = "^S={font_face=Tahoma fontSize=6pt color=black just=c}NOTE: Overall ... ";
I'd still be curious how to left-justify text, but not break, or overwrite, the left border.
Hi:
Do you want to change the STYLE template that you use with this report? If so, then the USERTEXT style element changes the attributes for ODS TEXT strings. Here's an example:
I had to fiddle with the height of the region. so that the y and the p did not encroach on the bottom border. I also changed the color to red in the template, so you could be sure that the template was being used for the ODS TEXT strings. Since I had the template in play, I took out the ASIS=ON and other attributes.
Cynthia
OK, thanks! That's a nice workaround. It leaves the region border alone, and indents the "marginleft" just enough so the text starts just to the right of the border line itself.
I usually don't want to bother with PROC TEMPLATE, because I don't write that syntax very often, so I'd have to look up an example, and determine which style I need to change, and what attributes I can change, etc. I had not heard of the class "usertext" before.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.