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

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;

 

1 ACCEPTED SOLUTION
4 REPLIES 4
Cynthia_sas
Diamond | Level 26
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
morglum
Quartz | Level 8

So there is a work around, thanks!

 

morglum
Quartz | Level 8

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

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 4 replies
  • 2546 views
  • 0 likes
  • 2 in conversation