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