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
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;
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?
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
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/
Just add COLUMNS=2 to your ODS PDF statement, and your KPI's will be adjacent. Will this work for you?
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?
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;
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
Does startpage=no on the ODS PDF statement give what you want?
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!
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.