The SAS Output Delivery System and reporting techniques

^{lastpage} not playing nice with ^preimage

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 96
Accepted Solution

^{lastpage} not playing nice with ^preimage

[ Edited ]

Hi everyone,

 

Whenever I had a reference to ^{lastpage} , my  image added using ^preimage disappears, like in the minimal working  example (MWE) below.  Any idea how I could go to get both in the same report?

thanks

 

 


ods pdf file="c:\temp\report1.pdf" dpi=150 style=minimal ;
OPTIONS NODATE NONUMBER;
ods escapechar = '^'; 

Title1 j = l '^S={preimage="https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Quebec_Nordiques_Logo.svg/200px-Quebec_Nordiques_Logo.svg.png" '
				j=r "Report";

footnote1 j=l "Generated today"
					j=r "total number of pages:  ^{lastpage} - graph is not shown";


*footnote1 j=l "Generated today"
					j=r "current page number ^{thispage}  -graph is shown ";


proc sort data= sashelp.class out=temp;; by sex height weight;
run;

data temp;
set temp;
by sex;
if first.sex then sex2= sex;
else sex2="";
obs=_n_;
weight_cat= floor(weight/10)*10;
_empty=' ';
run;

proc report data=temp ls=120 ps=40 nowd 
	split="*"
	style(report)=
		[ frame = void /* outside borders: void, box, above/below, vsides/hsides, lhs/rhs */
 			rules = groups /* internal borders: none, all, cols, rows, groups */]
	style(header)=
		[just=r]
	style(column)=
		[just=r];

column 
	obs
	sex2
	name
	_empty
	("^S={just=c borderbottomwidth=2 borderbottomcolor=&lightgrey.} Metrics^{super 1}" height weight )
	row_color
;
define obs /display noprint;
define sex2/display  "Sex" style(header)=[just=l borderbottomwidth=2 borderbottomcolor=&lightgrey.] style(column)=[just=l];
define name /display "Name" style(header)=[just=l  borderbottomwidth=2 borderbottomcolor=&lightgrey.] style(column)=[just=l];
define _empty/' ' style(column)={cellwidth=1%}  style(header)=[just=c vjust=top borderbottomcolor=lightgrey]; 
define height/display  "Height" format =5.1 style(header)=[just=r borderbottomwidth=2 borderbottomcolor=&lightgrey.] style(column)=[just=r];
define weight /display "Weight^{super 2}" format =5.0 style(header)=[just=r borderbottomwidth=2 borderbottomcolor=&lightgrey.] style(column)=[just=r ] format=16.;
define row_color  /computed noprint;
  
compute row_color;
		if mod(obs,2)=1 then call define (_row_,"style","style=[background=&verylightgrey.]");
		if weight<=100 then call define ("weight","style","style=[font_weight=bold  background=GREEN ");
		if weight>=100 then call define ("weight","style","style=[font_weight=bold  background=red ");
endcomp;

run;
quit;
ods pdf close;

 


Accepted Solutions
Solution
‎02-15-2016 02:44 PM
SAS Super FREQ
Posts: 8,743

Re: ^{lastpage} not playing nice with ^preimage


All Replies
SAS Super FREQ
Posts: 8,743

Re: ^{lastpage} not playing nice with ^preimage

Hi, There is (I remember) a Tech Support note about using {LASTPAGE} with ODS PDF and images. My memory is that it doesn't work (something about having an image and the ESCAPECHAR control were incompatible). I will try to find the link.
cynthia
Solution
‎02-15-2016 02:44 PM
SAS Super FREQ
Posts: 8,743

Re: ^{lastpage} not playing nice with ^preimage

Frequent Contributor
Posts: 96

Re: ^{lastpage} not playing nice with ^preimage

So there is a work around, thanks!

 

Frequent Contributor
Posts: 96

Re: ^{lastpage} not playing nice with ^preimage

that being said, it would be nice if SAS could at least pop a warning...

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 505 views
  • 0 likes
  • 2 in conversation