Features: |
BY statement
OPTIONS statement option: NOBYLINE TITLE statement option: #BYVAL |
Sample library member: | GONCGRW1 |
goptions reset=all border;
data totals; length Dept $ 7 Site $ 8; input Dept Site Quarter Sales; datalines; Repairs Sydney 1 5592.82 Repairs Atlanta 1 9210.21 Tools Sydney 1 1775.74 Tools Atlanta 1 2424.19 Tools Paris 1 5914.25 Parts Atlanta 2 11595.07 Parts Paris 2 9558.29 Repairs Sydney 2 5505.31 Repairs Paris 2 7538.56 Tools Atlanta 2 1903.99 Tools Paris 2 7868.34 Parts Sydney 3 8437.96 Parts Paris 3 6789.85 Tools Atlanta 3 3048.52 Tools Paris 3 9017.96 Parts Sydney 4 6065.57 Parts Atlanta 4 9388.51 Parts Paris 4 8509.08 Repairs Atlanta 4 2088.30 Repairs Paris 4 5530.37 ;
ods html frame="sales_frame.html" contents="sales_contents.html" body="sales_body1.html" nogtitle;
title1 "Total Sales By Quarter"; footnote j=r "salesqtr ";
axis1 order=(0 to 60000 by 20000) minor=(number=1) label=none; axis2 label=none length=70pct value=("1Q" "2Q" "3Q" "4Q");
legend1 label=none shape=bar(4,4);
proc gchart data=totals; format sales dollar8.; vbar3d quarter / discrete sumvar=sales shape=cylinder subgroup=site cframe=grayaa caxis=black width=12 space=4 legend=legend1 maxis=axis2 raxis=axis1 des="Total Quarterly Sales" name="salesqtr"; run; quit;
proc sort data=totals out=qtrsort; by quarter site; run; quit;
footnote1; options nobyline;
title1 "Sales for Quarter #byval(quarter)"; proc report data=qtrsort nowindows; by quarter; column quarter site dept sales; define quarter / noprint group; define site / display group; define dept / display group; define sales / display sum format=dollar8.; compute after quarter; site="Total"; endcomp; break after site / summarize style=rowheader; break after quarter / summarize style=rowheader; run; quit;
ods html body="sales_body2.html";
title1 "Total Sales By Department"; footnote1 j=r "salesdep ";
axis1 label=none minor=(number=1); order=(0 to 100000 by 20000); axis2 label=none length=70pct;
proc gchart data=totals; format sales dollar8.; vbar3d dept / shape=cylinder subgroup=site cframe=grayaa width=12 space=4 sumvar=sales legend=legend1 maxis=axis2 raxis=axis1 caxis=black des="Total Department Sales" name="salesdep"; run; quit;
proc sort data=totals out=deptsort; by dept site; run; quit;
footnote1; title1 "Sales for #byval(dept)"; proc report data=deptsort nowindows; by dept; column dept site quarter sales; define dept / noprint group; define site / display group; define quarter / display group; define sales / display sum format=dollar8.; compute after dept; site="Total"; endcomp; break after site / summarize style=rowheader; break after dept / summarize style=rowheader; run; quit;
ods html body="sales_body3.html" gtitle;
proc sort data=totals out=sitesort; by site; run; quit;
title1 "Departmental Sales for #byval(site)"; footnote j=r "salespie ";
proc gchart data=sitesort; format sales dollar8.; by site; pie3d dept / noheading coutline=black sumvar=sales des="Department Sales" name="salespie"; run; quit;
ods html close;
data totals; length Dept $ 7 Site $ 8; input Dept Site Quarter Sales; datalines; Repairs Sydney 1 5592.82 Repairs Atlanta 1 9210.21 Tools Sydney 1 1775.74 Tools Atlanta 1 2424.19 Tools Paris 1 5914.25 Parts Atlanta 2 11595.07 Parts Paris 2 9558.29 Repairs Sydney 2 5505.31 Repairs Paris 2 7538.56 Tools Atlanta 2 1903.99 Tools Paris 2 7868.34 Parts Sydney 3 8437.96 Parts Paris 3 6789.85 Tools Atlanta 3 3048.52 Tools Paris 3 9017.96 Parts Sydney 4 6065.57 Parts Atlanta 4 9388.51 Parts Paris 4 8509.08 Repairs Atlanta 4 2088.30 Repairs Paris 4 5530.37 ;
axis1 order=(0 to 60000 by 20000) minor=(number=1) label=none; axis2 label=none length=70pct value=("1Q" "2Q" "3Q" "4Q");
proc gchart data=totals; format sales dollar8.; vbar3d quarter / discrete sumvar=sales shape=cylinder subgroup=site cframe=grayaa caxis=black width=12 space=4 legend=legend1 maxis=axis2 raxis=axis1 des="Total Quarterly Sales" name="salesqtr"; run; quit;
title1 "Sales for Quarter #byval(quarter)"; proc report data=qtrsort nowindows; by quarter; column quarter site dept sales; define quarter / noprint group; define site / display group; define dept / display group; define sales / display sum format=dollar8.; compute after quarter; site="Total"; endcomp; break after site / summarize style=rowheader; break after quarter / summarize style=rowheader; run; quit;
proc gchart data=totals; format sales dollar8.; vbar3d dept / shape=cylinder subgroup=site cframe=grayaa width=12 space=4 sumvar=sales legend=legend1 maxis=axis2 raxis=axis1 caxis=black des="Total Department Sales" name="salesdep"; run; quit;
footnote1; title1 "Sales for #byval(dept)"; proc report data=deptsort nowindows; by dept; column dept site quarter sales; define dept / noprint group; define site / display group; define quarter / display group; define sales / display sum format=dollar8.; compute after dept; site="Total"; endcomp; break after site / summarize style=rowheader; break after dept / summarize style=rowheader; run; quit;
proc gchart data=sitesort; format sales dollar8.; by site; pie3d dept / noheading coutline=black sumvar=sales des="Department Sales" name="salespie"; run; quit;