The SAS Output Delivery System and reporting techniques

image and text top valigned in title

Reply
Occasional Contributor
Posts: 7

image and text top valigned in title

Hi,

 

trying to align image and text to top that are both used in report title.

 

options 
orientation=portrait 
papersize=A4 
nodate 
nonumber 
nocenter 
missing=''
nomprint
leftmargin=2cm
rightmargin=1cm
topmargin=1cm
bottommargin=1cm
nobyline
;
ods listing close;
ods noptitle;
ods results on;
ods escapechar='^';
data aaa;
aaa = 'aaa'; output;
run;
ods pdf file="C:\test_report.pdf" style=styles.SasDocPrinter;
ods pdf nobookmarkgen;
title j=l '^S={just=l preimage="http://3h.ca/wp-content/uploads/2015/09/google_2015_logo_detail-300x100.png"}' 
j=r '^{style [font_size=10pt font_face=arial] TITLE 1 HERE}^{newline}^{style [font_size=10pt font_face=arial] TITLE 2 HERE ^{thispage}}'; 
proc report data = aaa;
run;
ods pdf close;
ods listing;

 

ods_valign.png

 

Tried with VJUST and WHITESPACE, but no luck. ODS LAYOUT is not an option, as this should be printed on every page in report. Any ideas?

 

Thank you in advance.

SAS Super FREQ
Posts: 8,743

Re: image and text top valigned in title

Hi:
This might be a question for Tech Support. I think this is the way it always works when you use preimage.

cynthia
Occasional Contributor
Posts: 7

Re: image and text top valigned in title

[ Edited ]

so I guess POSTIMAGE won't work either, the result will be vice versa. I also saw, there is an IMAGE option, but can't test it right now. However, maybe there are other ideas, how image (aligned to left) and several lines of text with page number (aligned right) can be presented with top vertical alignment (as in an image attached to initial post), so that pattern will be applied to every page of the report? Number of pages is not defined, so this should be dynamic solution. Output should be in PDF.

SAS Super FREQ
Posts: 8,743

Re: image and text top valigned in title

HI, with ODS destinations, you primarily have PREIMAGE and POSTIMAGE. You might be able to do it in graphic output using annotate functions, but you want PDF from a report, not a graphic image.

If you can make one whole image in a paint program, with your text and logo, aligned the way you want, then you would only have to have 1 image, but I suspect that the title probably changes from report to report.

I do not understand why this can't be ODS LAYOUT ... it was designed to work with ODS PDF. For example, look at this example on page 5 of this paper https://support.sas.com/resources/papers/proceedings13/015-2013.pdf at the way the string "Quote of the Day" is aligned to the top of the Oakwood Winery box.

cynthia
Occasional Contributor
Posts: 7

Re: image and text top valigned in title

[ Edited ]

Hi, well, yes, I can play around with ODS LAYOUT, but that doesn't solve my issue.. I want this header printed on every page of the report and number of pages is not defined, but ODS LAYOUT let's me generate header only on first page...

 

	/* START: Prep data */
	%macro create_data;
		%macro _dummy; %mend _dummy;

		data aaa;
			%do i = 1 %to 50;
				aaa = 'aaa'; output;
			%end;
		run;
	%mend create_data;
	%create_data;
	/* END: Prep data */

	options 
		orientation=portrait 
        papersize=A4 
        nodate 
        nonumber 
        nocenter 
        missing=''
		nomprint
     	leftmargin=2cm
		rightmargin=1cm
		topmargin=1cm
		bottommargin=1cm
		nobyline
	;
	ods listing close;
	ods noptitle;
	ods results on;
	ods escapechar='^';

	title;
	footnote;

	ods pdf file="C:\test_report.pdf" notoc style=styles.SasDocPrinter;
	ods pdf nobookmarkgen;

	ods layout gridded x=.1 in y=.1in columns=2 rows=2;
	ods region width=65% height=5%;

	data _null_;
		dcl odsout obj();
		obj.layout_gridded(columns: 1,
 							column_gutter: "0in",
 							row_gutter: "0in"); 
		obj.region();
		obj.image(file: "http://3h.ca/wp-content/uploads/2015/09/google_2015_logo_detail-300x100.png",
 					width: "200px",
 					height: "60px");

		obj.layout_end();
	run;

	ods region width=25% height=5% style={backgroundcolor=cxafbd91 textalign=r};
	ods text='^{style [font_size=10pt font_face=arial textalign=r] TITLE 1 HERE}^{newline}^{style [font_size=10pt font_face=arial textalign=r] TITLE 2 HERE, Page ^{thispage}}'; 

	ods region width=65%;
	proc report data = aaa;
	run;

	ods layout end;
	ods _all_ close;
	ods listing;

This is gridded layout, so from my understanding, columns should be same width. Of course I can try with absolute layout, so this would work so that I would have 1st row with 2 columns for header and 2nd row with 1 column for report, but still, this doesn't solve my issue with header row printed on every page of the report.

 

Maybe I don't know something here? Maybe there is onption in ODS LAYOUT, that let's me print some particular REGION whenever new page starts? And in such way, that PROC REPORT continues printing where it left on previous page? I am quite new to ODS, so almost every research on this topic gives me something new Smiley Happy

SAS Super FREQ
Posts: 8,743

Re: image and text top valigned in title

Hi:
It may be easier to just make an image that spans the whole page, titles included and use that in PREIMAGE for a title statement. Or, you might have to step into ODS LAYOUT. Either way, I think working with Tech Support will be your best bet -- choosing between alternatives will be harder when you are new to ODS.

cynthia
Occasional Contributor
Posts: 7

Re: image and text top valigned in title

sorry for late response.. I have solved this by defining backgroundimage= in custom style. This way logo is displayed on every page and Title justified right.

Ask a Question
Discussion stats
  • 6 replies
  • 262 views
  • 0 likes
  • 2 in conversation