BookmarkSubscribeRSS Feed
acordes
Rhodochrosite | Level 12

Hi @Cynthia_sas , you've been helping me out a few minutes ago.

 

I'm happy with the ods graphics output but when I choose ods pdf the preimages are shown completely dis-configured.

 

Furthrmore I'd like to add a grand total but by "producto" in my case. If I use the "rbreak after / summarize ;" statement I get an grand total but not separated by group.

 

ods pdf file='/caslibs/marketing/useimg.pdf' ;
options missing=' ';
proc report data=dna.all spanrows nowd style(report)=[rules=none frame=void linethickness=4 ];
where lowcase(brand) ne "other";

title 'KPI overview';
column logo brand producto  ren fin  kpi ;
define brand / group noprint;
define producto / group ;
define ren / sum;
define fin / sum;
define logo / computed  ;
define kpi / computed f=percent9.1;
break before brand / summarize; 
/* rbreak after / summarize; */

compute kpi;
kpi = ren.sum / fin.sum;
if strip(_break_) not in ("_RBREAK_" "" ) then CALL DEFINE('LOGO','STYLE',"STYLE=
{PREIMAGE='/caslibs/marketing/" ||TRIM(lowcase(brand))|| ".png?height=3cm'}");
endcomp;

run;
ods pdf close;

 

report_out.png

2 REPLIES 2
Norman21
Lapis Lazuli | Level 10

For sizing the graph, have you tried goptions? For example:

/* Size each graph 4in x 4in */
goptions hsize=4in vsize=4in;

from https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=graphref&docsetTarget=p0w...

Norman.
SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

acordes
Rhodochrosite | Level 12

Unfortunately this doesn't fix the problem.

 

the best result is when I use ods htm.

but it's not as automatic as I hoped.

 

After executing the code I download the htm to my windows environment's folder where I dropped as well the png the code dynamically assigns to "logo".

In order to achieve the right sizing of the images I open the htm with a text editor and add a height statement to the htm img line.

<img alt="" src="C:\Users\DKXENLO\Pictures\audi.png" style="width=5cm"

 

 

ods escapechar='^';
ods html file='/caslibs/danalytics/kapi.htm' ;
options missing=' ';
proc report data=dna.all spanrows nowd style(report)=[rules=none frame=void linethickness=4 ];
where lowcase(brand) ne "other";

title 'KPI overview';
column logo  brand producto  ren fin  kpi ;
define brand / group noprint;
define producto / group ;
define ren / sum;
define fin / sum;
define logo / computed  ;
define kpi / computed f=percent9.1;
break before brand / summarize; 
rbreak after / summarize  ;

compute kpi;
kpi = ren.sum / fin.sum;
if strip(_break_) not in ("_RBREAK_" "") then CALL DEFINE('LOGO','STYLE',"STYLE=
{PREIMAGE="" " ||TRIM(lowcase(brand))|| ".png?height=3cm"" }");
endcomp;

run;
ods html close;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 546 views
  • 0 likes
  • 2 in conversation