%let name=salmonella_epi_curve; filename odsout '.'; data my_data; format date date9.; input date date9. cases; datalines; 04mar2013 2 08mar2013 1 11mar2013 1 13mar2013 1 15mar2013 3 16mar2013 0 17mar2013 1 18mar2013 1 19mar2013 2 20mar2013 1 21mar2013 2 22mar2013 3 23mar2013 3 25mar2013 5 26mar2013 2 27mar2013 2 28mar2013 4 29mar2013 3 30mar2013 4 31mar2013 9 01apr2013 3 02apr2013 2 03apr2013 9 04apr2013 10 05apr2013 5 06apr2013 3 07apr2013 8 08apr2013 5 09apr2013 9 10apr2013 2 11apr2013 7 12apr2013 4 13apr2013 2 14apr2013 1 15apr2013 10 16apr2013 3 17apr2013 4 18apr2013 5 19apr2013 3 20apr2013 5 21apr2013 4 22apr2013 8 23apr2013 1 24apr2013 1 25apr2013 5 26apr2013 3 27apr2013 4 28apr2013 5 29apr2013 4 30apr2013 3 01may2013 4 02may2013 1 03may2013 1 04may2013 6 05may2013 1 06may2013 2 07may2013 1 08may2013 7 09may2013 3 10may2013 2 11may2013 1 12may2013 2 13may2013 2 14may2013 0 15may2013 3 16may2013 2 17may2013 0 18may2013 1 19may2013 2 20may2013 6 21may2013 0 22may2013 0 23may2013 1 24may2013 3 25may2013 1 26may2013 0 27may2013 3 28may2013 1 29may2013 1 30may2013 2 31may2013 1 01jun2013 1 02jun2013 1 03jun2013 3 04jun2013 0 05jun2013 1 06jun2013 2 07jun2013 2 08jun2013 2 09jun2013 2 10jun2013 1 11jun2013 0 12jun2013 5 13jun2013 0 14jun2013 2 15jun2013 2 16jun2013 1 17jun2013 0 18jun2013 2 19jun2013 0 20jun2013 1 21jun2013 2 22jun2013 1 23jun2013 1 24jun2013 1 25jun2013 2 26jun2013 1 27jun2013 1 28jun2013 0 29jun2013 0 30jun2013 0 01jul2013 2 02jul2013 0 03jul2013 0 04jul2013 0 05jul2013 1 06jul2013 3 07jul2013 0 08jul2013 0 09jul2013 1 10jul2013 0 11jul2013 0 12jul2013 0 13jul2013 0 14jul2013 1 15jul2013 1 16jul2013 0 17jul2013 0 18jul2013 0 19jul2013 0 20jul2013 0 21jul2013 2 22jul2013 1 23jul2013 3 24jul2013 1 25jul2013 0 26jul2013 0 27jul2013 0 28jul2013 1 29jul2013 0 30jul2013 0 31jul2013 0 01aug2013 0 02aug2013 0 03aug2013 0 04aug2013 0 ; run; data my_data; set my_data; length my_html $300; my_html='title='||quote(trim(left(cases))||' cases on '||trim(left(put(date,WEEKDATE. )))); run; data anno_dates; length function $8 color $16; xsys='2'; ysys='1'; hsys='3'; when='a'; do date='01mar2013'd to '16aug2013'd by 14; /* step by 2-week */ /* axis text */ x=date; y=-3; function='label'; color=''; size=.; position='4'; angle=45; text=put(date,monname3.)||'-'||put(date,day.); if date^='16aug2013'd then output; /* axis tickmarks */ function='move'; x=date; y=0; output; function='draw'; color="gray77"; y=-1; size=.001; output; end; run; /* Some of the annotation is outside of the normal 0-100 coordinates. This generates an 'error' in annotate, and once a certain limit is reached, annotate stops drawing. I bump that limit way up, to make sure all my annotations are drawn :) */ data ignore_error; function='seterror'; size=100000; output; run; data anno_dates; set ignore_error anno_dates; run; data anno_gray_range; length function $8; xsys='2'; ysys='1'; hsys='3'; when='a'; /* transparent gray area */ x='23jul2013'd; y=0; function='move'; output; x='16aug2013'd; y=100; function='bar'; color='A00000033'; style='solid'; output; /* boxplot-like range thingey */ color='gray22'; size=.001; x='23jul2013'd; y=98; function='move'; output; y=102; function='draw'; output; x='16aug2013'd; y=98; function='move'; output; y=102; function='draw'; output; x='23jul2013'd; y=100; function='move'; output; x='16aug2013'd; function='draw'; output; /* text */ function='label'; position='5'; color='gray44'; size=1.8; x='04aug2013'd; y=112; text='Illnesses that began'; output; y=y-3.5; text='during this time may'; output; y=y-3.5; text='not yet be reported'; output; run; goptions device=png; goptions border; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Salmonella 'Epi Curve' example") style=htmlblue; goptions gunit=pct htitle=3.2 ftitle="albany amt" htext=2.4 ftext="albany amt"; axis1 label=(j=c 'Number of' j=c 'Persons') order=(0 to 12 by 2) minor=none offset=(0,0); axis2 label=(font="albany amt/bold" 'Date of Illness Onset, 2013') value=(angle=90 c=white h=1.0) order=('01mar2013'd to '16aug2013'd by 1); pattern1 v=s c=cx82bf02; title1 j=l move=(+10,+0) h=3.3 ls=1.5 "August 19, 2013"; title2 j=l move=(+10,+0) h=3.3 "Persons infected with the outbreak strain of " c=red font="albany amt/italic" "Salmonella Typhimurium,"; title3 j=l move=(+10,+0) h=3.3 "by date of illness onset"; title4 a=-90 h=2pct ' '; proc gchart data=my_data anno=anno_dates; vbar date / discrete type=sum sumvar=cases raxis=axis1 maxis=axis2 noframe space=0 coutline=gray77 anno=anno_gray_range html=my_html des='' name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING;