ods html close; %let gpath=C:\temp\Pie; %let macroLoc=C:\temp\Pie; %let dpi=200; ods listing style=listing gpath="&gpath" image_dpi=&dpi; options sasautos=("¯oLoc", sasautos); options mautosource mprint mlogic; proc format; value $sex 'M'='Male' 'F'='Female'; run; /*--Freq Pie Chart--*/ ods graphics / reset width=3in height=3.5in imagename='BasicPieChart'; %SGPIE(data=sashelp.class, category=sex, dataskin=none, title=Class Size by Sex, format=format sex $sex.); /*--Freq Pie Chart--*/ ods graphics / reset width=3in height=3.5in imagename='BasicPieChartColors'; %SGPIE(data=sashelp.class, category=sex, title=Class Size by Sex, dataColors=forestGreen gold, format=format sex $sex.); /*--Percent Pie Chart--*/ ods graphics / reset width=3in height=3.5in imagename='BasicPieChartGloss'; %SGPIE(data=sashelp.class, category=sex, startangle=0, title=Class Size by Sex, ResponseLabel=false, Percentlabel=true, legend=false, format=format sex $sex.); /*--Pie Chart of Actual by Product--*/ ods graphics / reset width=4in height=3.5in antialiasmax=1500 imagename='PieChartRespGloss'; %SGPIE(data=sashelp.prdsale, category=product, response=actual, dataskin=gloss, title=Actual Sales by Product, Legend=True, dataLabelContent=Response, footnote=Data Set: SAShelp.prdsale, LegendHAlign=right, LegendAcross=1, footnotefontsize=6); /*--Pie Chart of Actual by Product--*/ ods graphics / reset width=4in height=4in antialiasmax=1500 imagename='PieChartRespGloss2'; %SGPIE(data=sashelp.prdsale, category=product, response=actual, dataskin=gloss, title=Actual Sales by Product, Legend=True, dataLabelContent=Response, footnote=Data Set: SAShelp.prdsale, LegendValign=bottom, footnotefontsize=6); /*--Pie Chart of Actual by Product--*/ /*ods graphics / reset width=4in height=3.5in antialiasmax=1500 imagename='PieChartRespGlossCRender';*/ /*%SGPIE(data=sashelp.prdsale, category=product, response=actual, */ /* dataskin=gloss, title=Actual Sales by Product (CRender), Legend=True, dataLabelContent=Response,*/ /* footnote=Data Set: SAShelp.prdsale, LegendValign=bottom, CRender=True,*/ /* footnotefontsize=6);*/ /*--Grouped Pie Chart--*/ ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='GroupedPieChartRespGloss'; %SGPIE(data=sashelp.prdsale, category=product, response=actual, group=year, dataskin=gloss, title=Actual Sales by Product and Year, footnote=Data Set: SAShelp.prdsale, footnotefontsize=9, datalabelfontsize=7); /*--Grouped Pie Chart Stack--*/ ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='GroupedPieChartStack'; %SGPIE(data=sashelp.prdsale, category=product, response=actual, group=year, dataskin=gloss, groupgap=10, title=Actual Sales by Product and Year, footnote=Data Set: SAShelp.prdsale, footnotefontsize=9, datalabelfontsize=6); /*--Pie Chart Colors--*/ ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='PieChartColors'; %SGPIE(data=sashelp.prdsale, category=product, response=actual, dataskin=gloss, groupgap=10, title=Actual Sales by Product and Year, footnote=Data Set: SAShelp.prdsale, dataColors=cxd0d0f0 cxc7c7f0 cxc0c0f0 cxb7b7f0 cxb0b0f0, footnotefontsize=9, datalabelfontsize=6); /*--Pie Chart Colors 2--*/ ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='PieChartColors2'; %SGPIE(data=sashelp.prdsale, category=product, response=actual, dataskin=crisp, groupgap=10, title=Actual Sales by Product and Year, footnote=Data Set: SAShelp.prdsale, dataColors=cx4f6f4f cx5f7f5f cx678767 cx709070 cx80a080, footnotefontsize=9, datalabelfontsize=6); /*--Other Slice Pie Chart--*/ ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='OtherSlice'; %SGPIE(data=sashelp.cars, category=make, dataskin=gloss, groupgap=10, title=Share of Market by Make, footnote=Data Set: SAShelp.cars, responselabel=false, percentlabel=true, footnotefontsize=9, datalabelfontsize=6); /*--No Other Slice Pie Chart--*/ ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='NoOtherSlice'; %SGPIE(data=sashelp.cars, category=make, dataskin=gloss, groupgap=10, title=Share of Market by Make, footnote=Data Set: SAShelp.cars, responselabel=false, percentlabel=true, footnotefontsize=9, datalabelfontsize=6, otherslice=false); proc sort data=sashelp.cars out=CarsByOrigin; by origin; run; /*--Share of Sedans--*/ data GTL_Sedans; retain Sedans 0 Rest 0; format count percent5.0; keep Origin Type Count; set CarsByOrigin nobs=totalcount; by origin; if first.origin then do; Sedans=0; Rest=0; end; if type eq 'Sedan' then Sedans+1; else Rest+1; if last.origin then do; Type='Sedans'; Count=Sedans/totalcount; output; Type='Rest'; Count=Rest/totalcount; output; end; run; /*--Two Slice pie Chart--*/ ods listing style=analysis; ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='SedanShare'; %SGPIE(data=GTL_Sedans, category=type, response=count, title=Share of Market for Sedans, DataLabelFontSize=12, responselabel=true, percentlabel=false); /*--Two Slice pie Chart--*/ ods listing style=analysis; ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='SedanShareVert'; %SGPIE(data=GTL_Sedans, category=type, response=count, dataskin=gloss, title=Share of Market for Sedans, startangle=0, DataLabelFontSize=12, responselabel=true, percentlabel=false); /*--Share of SUVs--*/ data GTL_SUVs; retain SUVs 0 Rest 0; format count percent5.0; keep Origin Type Count; set CarsByOrigin nobs=totalcount; by origin; if first.origin then do; SUVs=0; Rest=0; end; if type eq 'SUV' then SUVs+1; else Rest+1; if last.origin then do; Type='SUV'; Count=SUVs/totalcount; output; Type='Rest'; Count=Rest/totalcount; output; end; run; /*--Two Slice Pie Chart with horizonal alignment--*/ ods listing style=analysis; ods graphics / reset width=3in height=3.5in antialiasmax=1500 imagename='SUVShareHorz'; %SGPIE(data=GTL_SUVs, category=type, response=count, title=Share of Market for SUVs, dataskin=crisp, DataLabelFontSize=12, responselabel=true, percentlabel=false); data class; set sashelp.class; if sex='F' then url='http://www.sas.com'; else url='http://www.cnn.com'; run; ods html; proc print;run; ods html close; /*--Freq Pie Chart URL--*/ ods _all_ close; ods html body='Pie.html' path="&gpath" gpath="&gpath"; ods graphics / reset width=3in height=3.5in; %SGPIE(data=class, category=sex, dataskin=none, url=url, drilltarget=_self, title=Class Size by Sex, format=format sex $sex.); ods html close;