%let name=halloween_candy_suppliers; filename odsout '.'; /* Based on 2013 article: http://www.foodandwaterwatch.org/impact/whats-really-scary-halloween */ /* Create a percent-format (pfmt) to display a value like 42.1 as 42.1% This way you don't have to modify the actual data (divide it by 100) to use the percent7.1 format directly. */ proc fcmp outlib=work.functions.smd; function pfmt(value) $; length foo $7; foo=put(value/100,percent7.1); return(foo); endsub; run; options cmplib=(work.functions); proc format; value pfmt other=[pfmt()]; run; data my_data; input value name $ 6-80; format value pfmt.; datalines; 42.1 Hershey's 42.1 Mars 15.2 Nestle 0.6 Other ; run; data my_data; set my_data; length link $100; if name="Hershey's" then link='http://www.hersheys.com/pure-products.aspx'; if name="Mars" then link='http://www.mars.com/global/brands/chocolate.aspx'; if name="Nestle" then link='http://www.nestleusa.com/brands/chocolate'; if name="Other" then link='halloween_candy.htm'; if name='Nestle' then name='Nestl'||'e9'x; length my_html $300; my_html= 'title='||quote(trim(left(name))||': '||trim(left(put(value,percent7.1))))|| ' href='||quote(trim(left(link))); run; goptions device=png; goptions border; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Halloween Candy Suppliers") style=htmlblue; goptions gunit=pct htitle=5.5 ftitle="albany amt/bold" htext=3.4 ftext="albany amt"; goptions ctext=gray33; pattern1 v=s color=cxe5d8bd; pattern2 v=s color=cxfbb4ae; pattern3 v=s color=cxdecbe4; pattern4 v=s color=cxccebc5; title1 ls=2.5 "Halloween Candy Suppliers"; footnote h=3 ' '; proc gchart data=my_data; pie name / type=sum sumvar=VALUE angle=242 ascending noheading value=inside slice=outside coutline=gray44 html=my_html des='' name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING;