%let name=mpgtree; filename odsout '.'; libname mydata '../democd29'; %let year=2008; proc sql; create table mydata as select * from mydata.mpg_data where year eq &year and class contains 'S.U.V.' ; quit; run; /* data mydata; set mydata (obs=200); run; */ data mydata; set mydata; length myhtml $500; myhtml= 'title='||quote( trim(left(year))||' '||trim(left(manufacturer))||' '||trim(left(model))||'0d'x|| trim(left(Transmission))||' transmission / '||trim(left(Cylinders))||' cyl / '||trim(left(Engine_Liters))||' liter'||' / '||trim(left(Extra_info))||'0d'x|| trim(left(put(mpg_hwy,comma5.0)))||' mpg highway / '||trim(left(put(mpg_city,comma5.0)))||' mpg city'|| ' ')||' '||'target="mpgtable" href='||quote('mpgtree.htm'||'#'||translate(trim(left(manufacturer)),'_',' ')); length idnum $50; idnum=trim(left(_n_)); run; /* Creat the sas/graph map data set */ libname here '.'; /* proc datasets lib=here nolist nowarn; delete mpgmap; run; %include 'treemap_inc.sas'; %treemac(mydata,manufacturer,idnum,mpg_hwy,here.mpgmap,0,0,130,100); */ /* Create annotate data sets (outline & labels for school_type) */ %include 'treeanno_inc.sas'; %treelabel(here.mpgmap,manufacturer,black,annofram,annolabel); /* make the black-colored border around the framed-in manufacturers a little thicker. */ data annofram; set annofram; size=.4; run; /* Make the label font a little larger */ data annolabel; set annolabel; size=2.0; position='b'; run; data tree_anno; set annofram annolabel; run; GOPTIONS DEVICE=gif; goptions xpixels=900 ypixels=650; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="SUV Highway MPG (&year)") style=minimal; goptions noborder; goptions gunit=pct ftitle="arial" ftext="arial" htitle=4 htext=2.5; goptions cback=white; title "SUV Highway MPG (&year)"; title2 "mouse over tiles to see detailed info"; title3 "click tiles to drilldown to list"; /* footnote "size = MPG color = MPG"; footnote2 h=.5 " "; */ legend1 position=(right middle) across=1 shape=bar(.2in,.2in) label=(position=top j=center 'MPG'); pattern1 v=s c=cxd7191c; pattern2 v=s c=cxfdae61; pattern3 v=s c=cxffffbf; pattern4 v=s c=cxa6d96a; pattern5 v=s c=cx1a9641; proc gmap data=mydata map=here.mpgmap anno=tree_anno; id manufacturer idnum; choro mpg_hwy / levels=5 coutline=gray88 woutline=1 legend=legend1 html=myhtml des="" name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING; data mydata; set mydata; length anchor $100; anchor = ''; run; proc sort data=mydata out=mydata; by manufacturer descending mpg_hwy; run; filename mytable "./&name..htm" mod; data _null_; set mydata end=last; by manufacturer; file mytable; if first.manufacturer then do; put "
"; put "
"; put anchor; put "
"; put "

"; put manufacturer; put "

"; put "
"; put ""; put ""; put ""; put ""; put ""; put ""; put ""; end; put ""; put ""; put ""; put ""; put ""; put ""; put ""; put ""; if last.manufacturer then do; put "
MPG HighwayModelCylindersEngine_LitersTransmissionExtra_info
"; put mpg_hwy; put ""; put model; put ""; put cylinders; put ""; put engine_liters; put ""; put transmission; put ""; put extra_info; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put "
"; put ""; put ""; end; run; quit; /* trim(left(year))||' '||trim(left(manufacturer))||' '||trim(left(model))||'0d'x|| trim(left(Transmission))||' transmission / '||trim(left(Cylinders))||' cyl / '||trim(left(Engine_Liters))||' liter'||' / '||trim(left(Extra_info))||'0d'x|| trim(left(put(mpg_hwy,comma5.0)))||' mpg highway / '||trim(left(put(mpg_city,comma5.0)))||' mpg city'|| */