%let name=pfizer; filename odsout '.'; options mprint; /* *** Here is where you can easily change the variables *** */ %let mymap=here.pfizmap; %let idvar1=category; %let idvar2=drug; %let sumvar=Revenue; %let year=2003; goptions reset=global; libname here '.'; filename pfifile "pfizer.dat"; data mydata; infile pfifile; input cat $ 1-3 Category $ 5-39 Drug $ 41-64 y2003 y2002 y2001; run; proc sort data=mydata out=mydata; by cat category drug; run; proc transpose data=mydata out=mydata; by cat category drug; run; data mydata; set mydata; year=substr(_name_,2,4); /* note - year must be character, rather than numeric, for treemac macro */ Revenue=col1; run; proc sql; create table mydata as select * from mydata where (year eq "&year") and (Revenue ne .) order by Revenue descending; quit; run; /* Creat the sas/graph map data set */ /* proc datasets lib=here nolist nowarn; delete pfizmap; run; %include 'treemap_inc.sas'; %treemac(mydata,category,drug,Revenue,&mymap,0,0,130,65); */ /* Create annotate data sets - outline (tree_fram) & labels (tree_labl) */ %include 'treeanno_inc.sas'; %treelabel(&mymap,category,cx00ff00,tree_fram,tree_labl); data tree_fram; set tree_fram; color='cx1f61a9'; size=.5; run; data tree_anno; set tree_labl tree_fram; run; /* Create a response data set, to control the colors of the areas. You could use the same variable the you used to size the treemap rectangles (such as Sales, in this example). */ proc sql; create table mydata as select unique cat, category, drug, sum(Revenue) format=dollar20.0 as Revenue from mydata group by category, drug; quit; run; /* Add some html title= mouseover/rollover/charttip text for the tiles */ data mydata; set mydata; length myhtml $500; myhtml='title='|| quote( "Category: "||trim(left(category))||'0D'x|| "Drug: "||trim(left(drug))||'0D'x|| "Revenue: "||trim(left(put(revenue,dollar20.0)))||' ' ) ||' '|| 'href="pfi_'||trim(left(lowcase(cat)))||'.htm"' ; run; data pic_anno; length function style color $ 8 html $ 300 text $ 50; xsys='3'; ysys='3'; hsys='3'; when='a'; function='move'; x=5; y=89; output; function='image'; x=x+11; y=y+10; imgpath='lg_pfizer.gif'; style='fit'; output; run; legend1 position=(bottom) across=5 shape=bar(.12in,.12in) label=(position=top j=c 'Revenues ($Million) '); GOPTIONS DEVICE=png; goptions xpixels=800 ypixels=550; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Pfizer Revenues Treemap") style=minimal gtitle gfootnote ; goptions noborder; goptions cback=white; goptions ftitle="arial" ftext="arial" htitle=5pct htext=3pct; title link="http://www.pfizer.com/are/investors_reports/annual_2003/financial/p2003fr07c_09.htm" "Pfizer Revenues (year &year)"; title2 "Major Pharmaceutical Products"; title3 a=90 h=3pct " "; title4 a=-90 h=3pct " "; pattern1 v=s c=cxfeebe2; pattern2 v=s c=cxfa9fb5; pattern3 v=s c=cxf768a1; pattern4 v=s c=cxc51b8a; pattern5 v=s c=cxb0017e; proc gmap data=mydata map=&mymap all anno=tree_anno; id category drug; choro revenue / levels=5 coutline=graycc anno=pic_anno html=myhtml legend=legend1 des="" name="&name"; run; proc sort data=mydata out=mydata; by category drug; run; title; proc print data=mydata noobs label; format revenue dollar20.0; label revenue='Revenue ($Million)'; var category drug revenue; sum revenue; run; quit; ODS HTML CLOSE; ODS LISTING;