BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bnawrocki
Quartz | Level 8

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: 

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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:

change_template_usertext.png


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

View solution in original post

6 REPLIES 6
Cynthia_sas
SAS Super FREQ

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

bnawrocki
Quartz | Level 8

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;

Capture.PNG

bnawrocki
Quartz | Level 8

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 ... ";

capture2.png

 

I'd still be curious how to left-justify text, but not break, or overwrite, the left border.

Cynthia_sas
SAS Super FREQ

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:

change_template_usertext.png


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

bnawrocki
Quartz | Level 8

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.

Cynthia_sas
SAS Super FREQ
You were using STYLE=HTMLBLUE in your original posted code, so that's what I used as Parent= in the template code. However, HTMLBLUE is designed for HTML, so in production, I'd recommend using a style like Pearl which was designed for PDF.
The USERTEXT style element in the CLASS statement is the element that controls ODS TEXT= strings. You should be able to use my template code and only need to delete the color=red line.
Cynthia

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3020 views
  • 0 likes
  • 2 in conversation