Data visualization with SAS programming

Multiple Bullet Graphs on one page

Accepted Solution Solved
Reply
Super Contributor
Posts: 291
Accepted Solution

Multiple Bullet Graphs on one page

The attached code more or less does what I'm looking for except for the fact that I'd like to have both graphs on one page.  Is there a way to put the graphs into a catalog so that I can then replay them with proc greplay?  Or is this done some other way for the GKPI procedure?

Thank you,

Bill

Attachment

Accepted Solutions
Solution
‎05-07-2014 04:02 PM
SAS Super FREQ
Posts: 888

Re: Multiple Bullet Graphs on one page

Here is the main idea using your code. You can turn it into a macro to make it more compact.

goptions reset=all device=javaimg hsize=4in vsize=0.75in;

ods html;

proc gkpi mode=basic;

hbullet                                                                                                                                                                                                                    

   actual=38000  bounds=(0 30000 40000 50000)/ target=40000                                                                                                                                                                

   colors=(cx747474 /*cx8C8C8C*/ cxB2B2B2 /*cxD2D2D2*/ cxE6E6E6)                                                                                                                                                           

   label='Shipments'

   lfont=(f='helvetica' c=black h=20)

   afont=(f='helvetica' c=red h=20)

   bfont=(f='helvetica' c=blue h=20) name="kpi1";

run;

hbullet

   actual=38000  bounds=(0 30000 40000 50000)/ target=40000

   colors=(cx747474 /*cx8C8C8C*/ cxB2B2B2 /*cxD2D2D2*/ cxE6E6E6)

   label='Production'

   lfont=(f='helvetica' c=black h=20)

   afont=(f='helvetica' c=red h=20)

   bfont=(f='helvetica' c=blue h=20) name="kpi2";

run;

quit;

ods html close;

ods listing;

goptions reset=all

   iback="kpi1.png"

   imagestyle=fit

   device=sasprtc

   nodisplay;

proc gslide name="kpi1";

run; quit;

goptions iback="kpi2.png";

proc gslide name="kpi2";

run; quit;

ods listing close;

goptions reset=all dev=sasprtc display hsize=8in vsize=0.75in;

ods pdf file='test.pdf';

proc greplay igout=work.gseg nofs

   tc=sashelp.templt template=h2;    

   treplay 1:kpi2 2:kpi2;                                                                                                                                                                                                  

quit;                         

ods pdf close;

View solution in original post


All Replies
SAS Super FREQ
Posts: 888

Re: Multiple Bullet Graphs on one page

GKPI output is not written to a catalog. It's better to use ODS DOCUMENT to store GKPI output and PROC DOCUMENT to replay it. Are you familiar with ODS documents?

Super Contributor
Posts: 291

Re: Multiple Bullet Graphs on one page

Dan, I have no experience with proc document.  Ultimately I'm looking for "proc greplay" flexibility.  What about this (from SAS/GRAPH(R) 9.4: Reference, Second Edition)?  Except that we only have SAS 9.3 TS1M0

Note: To use output from the GKPI procedure in a dashboard generated with the GREPLAY procedure, you must first create a GRSEG containing the GKPI procedure output. You can use the IBACK=”gkpiImage.png”  option in the GOPTIONS statement with the GSLIDE or GANNO procedures to generate the GRSEG.  But, I've no idea how to do this GKPI either.

Your help is appreciated,

Bill


SAS Super FREQ
Posts: 1,078

Re: Multiple Bullet Graphs on one page

If you have not found a solution to creating a set of bullet KPI's using proc GKIP, here is another way to do them quite easily.  No need for GREPLAY or document.  For the simple case, you can use SGPLOT to create one or more bullet bars by overlaying two hbars with different values and widths.

http://blogs.sas.com/content/graphicallyspeaking/2012/02/23/dashboard-graphs-revisited/

SAS Super FREQ
Posts: 888

Re: Multiple Bullet Graphs on one page

Just add COLUMNS=2 to your ODS PDF statement, and your KPI's will be adjacent. Will this work for you?

Super Contributor
Posts: 291

Re: Multiple Bullet Graphs on one page

Dan, thanks again, but how do I do this ...

Note: To use output from the GKPI procedure in a dashboard generated with the GREPLAY procedure, you must first create a GRSEG containing the GKPI procedure output. You can use the IBACK=”gkpiImage.png”  option in the GOPTIONS statement with the GSLIDE or GANNO procedures to generate the GRSEG.

in 9.3?

Solution
‎05-07-2014 04:02 PM
SAS Super FREQ
Posts: 888

Re: Multiple Bullet Graphs on one page

Here is the main idea using your code. You can turn it into a macro to make it more compact.

goptions reset=all device=javaimg hsize=4in vsize=0.75in;

ods html;

proc gkpi mode=basic;

hbullet                                                                                                                                                                                                                    

   actual=38000  bounds=(0 30000 40000 50000)/ target=40000                                                                                                                                                                

   colors=(cx747474 /*cx8C8C8C*/ cxB2B2B2 /*cxD2D2D2*/ cxE6E6E6)                                                                                                                                                           

   label='Shipments'

   lfont=(f='helvetica' c=black h=20)

   afont=(f='helvetica' c=red h=20)

   bfont=(f='helvetica' c=blue h=20) name="kpi1";

run;

hbullet

   actual=38000  bounds=(0 30000 40000 50000)/ target=40000

   colors=(cx747474 /*cx8C8C8C*/ cxB2B2B2 /*cxD2D2D2*/ cxE6E6E6)

   label='Production'

   lfont=(f='helvetica' c=black h=20)

   afont=(f='helvetica' c=red h=20)

   bfont=(f='helvetica' c=blue h=20) name="kpi2";

run;

quit;

ods html close;

ods listing;

goptions reset=all

   iback="kpi1.png"

   imagestyle=fit

   device=sasprtc

   nodisplay;

proc gslide name="kpi1";

run; quit;

goptions iback="kpi2.png";

proc gslide name="kpi2";

run; quit;

ods listing close;

goptions reset=all dev=sasprtc display hsize=8in vsize=0.75in;

ods pdf file='test.pdf';

proc greplay igout=work.gseg nofs

   tc=sashelp.templt template=h2;    

   treplay 1:kpi2 2:kpi2;                                                                                                                                                                                                  

quit;                         

ods pdf close;

Super Contributor
Posts: 291

Re: Multiple Bullet Graphs on one page

Thank you Dan for the code sample.  With this I can achieve what I need, but I do wonder why GKPI is restricted to the javaimg driver.  Are there any plans to give it more driver options?

Thanks again,

Bill

Grand Advisor
Posts: 10,196

Re: Multiple Bullet Graphs on one page

Does startpage=no on the ODS PDF statement give what you want?

Super Contributor
Posts: 291

Re: Multiple Bullet Graphs on one page

It does put both charts on the same page, so it's a possibility for a report.  I'd prefer the flexibility of something akin to proc greplay.  Thanks though!

Grand Advisor
Posts: 10,196

Re: Multiple Bullet Graphs on one page

If you have the capability to turn an HTML file into PDF you might investigate HTMLPANEL tagset. It has some of the features to display the outputs inside specified coordinates on a logical page though I don't think the overlaps possible with Greplay templates are valid.

☑ This topic is SOLVED.

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

Discussion stats
  • 10 replies
  • 876 views
  • 6 likes
  • 4 in conversation