Annotated Sample Program - Interim Version
Although this program is not finished, you can use it as a model for beginning your own program. Be sure to edit the ODS HTML PATH= string (shown in red) to conform to your system's file structure, and add any options, suboptions, or statements necessary in your operating environment. |
data work.saletrnd; set finance.prdsal2; /* create variables to hold HREF address strings */ length PriDrill $ 40 SecDrill $ 40; /* define the HTML links for the primary chart */ if year=1995 then pridrill='HREF="sales95.html"'; if year=1996 then pridrill='HREF="sales96.html"'; if year=1997 then pridrill='HREF="sales97.html"'; if year=1998 then pridrill='HREF="sales98.html"'; /* define the HTML links for the secondary charts */ if quarter=1 then secdrill='HREF="#salesq1"'; if quarter=2 then secdrill='HREF="#salesq2"'; if quarter=3 then secdrill='HREF="#salesq3"'; if quarter=4 then secdrill='HREF="#salesq4"'; /* fix the format of the chart variable ACTUAL */ format actual dollar10.0; /* switch to HTML output...set the directory for GIF & */ /* HTML output and specify the name of the HTML file */ run; ods listing close; ods html path='c:\data\sales\reports' body='totalsales.html'; /* switch to GIF output for images...set image size */ goptions device=gif xpixels=480 ypixels=360; /* title of the primary chart */ title 'Total Sales by Year'; /* create a bar chart of sales by year... */ /* assign the HTML links held by PriDrill */ proc gchart data=work.saletrnd; vbar year / subgroup=prodtype discrete sumvar=actual html=pridrill; run; /* specify the HTML file name of the secondary chart... */ /* set the title and create a bar chart where YEAR=1995 */ ods html body='sales95.html'; title 'Sales for 1995 by Quarter'; proc gchart data=work.saletrnd; vbar quarter / sumvar=actual subgroup=product discrete html=secdrill; where year=1995; run; /* specify the HTML file name of the secondary chart... */ /* set the title and create a bar chart where YEAR=1996 */ ods html body='sales96.html'; title 'Sales for 1996 by Quarter'; proc gchart data=work.saletrnd; vbar quarter / sumvar=actual subgroup=product discrete html=secdrill; where year=1996; run; /* specify the HTML file name of the secondary chart... */ /* set the title and create a bar chart where YEAR=1997 */ ods html body='sales97.html'; title 'Sales for 1997 by Quarter'; proc gchart data=work.saletrnd; vbar quarter / sumvar=actual subgroup=product discrete html=secdrill; where year=1997; run; /* specify the HTML file name of the secondary chart... */ /* set the title and create a bar chart where YEAR=1998 */ ods html body='sales98.html'; title 'Sales for 1998 by Quarter'; proc gchart data=work.saletrnd; vbar quarter / sumvar=actual subgroup=product discrete html=secdrill; where year=1998; run; /* switch back to listing output */ quit; ods html close; ods listing; |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.