%let name=car_plots; filename odsout '.'; /* Based on data from ... http://www.nhtsa.gov/staticfiles/rulemaking/pdf/cafe/2011_Summary_Report.pdf http://www.nhtsa.gov/staticfiles/rulemaking/pdf/cafe/March_2012_Performance_Summary.pdf http://www.nhtsa.gov/staticfiles/rulemaking/pdf/cafe/Oct2012_Summary_Report.pdf; */ %let pdflink=http://www.nhtsa.gov/staticfiles/rulemaking/pdf/cafe/Oct2012_Summary_Report.pdf; PROC IMPORT OUT=car_data DATAFILE="mpg_data.xls" DBMS=EXCEL REPLACE; RANGE="mpg_data$"; GETNAMES=YES; MIXED=NO; SCANTEXT=YES; RUN; data anno1; set car_data (where=(model_year=2012)); function='label'; position='c'; xsys='2'; ysys='2'; x=model_year+.2; y=domestic_car_mpg; color='blue'; text='Domestic'; output; y=import_car_mpg; color='red'; text='Import'; output; run; data anno2; set car_data (where=(model_year=2011)); function='label'; xsys='2'; ysys='2'; x=model_year+.2; y=domestic_car_sales; color='blue'; position='c'; text='Domestic'; output; y=import_car_sales; color='red'; position='6'; text='Import'; output; run; goptions device=png xpixels=900 ypixels=600; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" style=sasweb; goptions ftitle="albany amt/bold" ftext="albany amt/bold" gunit=pct htitle=3.5 htext=2.5; axis1 label=('MPG') order=(15 to 40 by 5) minor=none offset=(0,0); axis2 label=none order=(1975 to 2015 by 5) minor=none offset=(0,3); symbol1 value=dot interpol=join color=blue; symbol2 value=dot interpol=join color=red; title1 ls=1.5 link="&pdflink" "Passenger Cars in the U.S."; title2 h=3.5 "Corporate Average Fuel Economy / CAFE"; title3 h=3.5 "(sales volume weighted)"; proc gplot data=car_data anno=anno1; plot domestic_car_mpg*model_year=1 import_car_mpg*model_year=2 / overlay vaxis=axis1 haxis=axis2 autovref cvref=graydd autohref chref=graydd des='' name="&name"; run; axis3 label=(j=c 'Cars Sold' j=c 'per year') order=(0 to 10000000 by 2000000) minor=none offset=(0,0); title1 ls=1.5 link="&pdflink" "Passenger Cars Sold in the U.S."; proc gplot data=car_data anno=anno2; format domestic_car_sales comma12.0; plot domestic_car_sales*model_year=1 import_car_sales*model_year=2 / overlay vzero vaxis=axis3 haxis=axis2 autovref cvref=graydd autohref chref=graydd des='' name="&name"; run; axis4 label=none order=(0 to 20000000 by 5000000) minor=none offset=(0,0); axis5 label=none value=(angle=90); pattern1 v=solid c=cx63B8FF; title1 ls=1.5 link="&pdflink" "Total Vehicle Sales in the U.S."; proc gchart data=car_data; format total_fleet_sales comma12.0; vbar model_year / discrete type=sum sumvar=total_fleet_sales raxis=axis4 maxis=axis5 autoref cref=graybb clipref des='' name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING;