BookmarkSubscribeRSS Feed
bconner
Fluorite | Level 6

Good morning,

 

I'm experimenting with the best way to define a border around  an ODS region in an absolute layout example.  What I'd like to see is a thin black border, title text inside it and have the background of the region not be white.

Using the sample code:

 

%let st=fontfamily='Arial' fontsize=10pt just=c cellwidth=7.2in cellheight=.31in vjust=c background=cyan;

ods pdf file="c:\temp\weekly.pdf";

ods layout absolute y=0in x=0in;

ods region y=.5in x=.4in width=7.25in height=.35in style=[borderwidth=1 bordercolor=black];

ods text="^{style[&st]Test Title1^nTest Title2}";

ods layout end;

ods pdf close;

 

Produces something close but not quite there.  If I declare the cell height/width the exact same as the region size, the borders from the region style get overlaid.  Tried adding border information into the style for the ods text statement but that had no effect.  ?

 

Thanks!

 

--Ben

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:
You're writing ODS TEXT, not using a TITLE statement. Just curious. There is a TitleandFooterContainer in the style template that might work to turn the border on for the container. Not sure about ODS TEXT styles because those are controlled by a different style element.

I rarely use Absolute layout .. just never had the kind of output where I could always rely on the text strings and data to be predictable.

But without going down the ODS LAYOUT/ODS REGION road, I always like to see how I can do what is needed without the fancy stuff. So this is what I came up with:

 

make_title_text_box.png

 

Cyan background is regular SAS Title statement with a custom style template and pink background is regular ODS TEXT strings with a custom style template. I thought I would need to use TitleandFooterContainer in the template, but I was able to put the border control in the style element directly for SystemTitle and UserText.

 

Code is here:

ods path work.tmp(update) sasuser.templat(update) sashelp.tmplmst(read);
 
proc template;
  define style makebox;
  parent=styles.pearl;
  class SystemTitle /
    frame=box
    background=cyan
	width=100%
	fontfamily='ArialUnicodeMS'
	fontsize=10pt
	fontweight=bold
	just=c
	vjust=m
	cellpadding=2px
	borderwidth=1px
	bordercolor=black
	color=black;

  class UserText from SystemTitle/
    frame=box
    background=pink
	width=100%
	fontfamily='ArialUnicodeMS'
	fontsize=10pt
	fontweight=bold
	just=c
	vjust=m
	cellpadding=2px
	borderwidth=1px
	bordercolor=purple
	color=black;
  end;
run;
 
options orientation=portrait center nodate nonumber 
        topmargin=1in bottommargin=1in leftmargin=1in rightmargin=1in;
		  
ods pdf file='c:\temp\usetitle_box.pdf' style=makebox;
title 'Test Title1^nTest Title2';
proc print data=sashelp.class(obs=1)
     style(table)={width=5in};
run;
ods pdf close;
title;

ods pdf file='c:\temp\useODSTEXT.pdf' style=makebox startpage=no;
ods text="Test Title1^nTest Title2";
proc print data=sashelp.class(obs=1)
     style(table)={width=5in};
run;
ods pdf close;
title;

Hope this helps give you some ideas.

 
Cynthia

bconner
Fluorite | Level 6

Hi Cynthia,

 

Yeah...most of the reports we do have very picky layout, so Absolute has been the tool of choice.  Also why I disabled titles, as I can't get those to line up exactly on top of a proc report and make it look like they grew there.

 

If I could make the area the title has sit exactly on top of the proc print, that would get close.  I'll play around with that and see if I can get it to work.

 

Thanks much!

 

--Ben

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1647 views
  • 1 like
  • 2 in conversation