%let name=mc1d; filename odsout '.'; %let mc1path=\\l72586.na.sas.com\public\VAST_2011\MC_1_Materials_3-30-2011\; libname mydata "&mc1path"; /* Find microblog postings with certain keywords (later, plot them on the map) */ data matches; set mydata.microblogs; flag=1; if index(text,' flu ')^=0 then do; output; end; else if index(text,' fever')^=0 then do; output; end; else if index(text,' chill')^=0 then do; output; end; else if index(text,' sweat')^=0 then do; output; end; else if index(text,' ache')^=0 then do; output; end; else if index(text,' pain')^=0 then do; output; end; else if index(text,' fatigue')^=0 then do; output; end; else if index(text,' cough')^=0 then do; output; end; else if index(text,' breathing')^=0 then do; output; end; else if index(text,' nausea')^=0 then do; output; end; else if index(text,' vomit')^=0 then do; output; end; else if index(text,' diarrhea')^=0 then do; output; end; run; /* Map for Mini-Challenge 1 http://hcil.cs.umd.edu/localphp/hcil/vast11/index.php/taskdesc/index */ %let map_bw=&mc1path.Vastopolis_Map.gif; /* Coordinates from the map in the MC1_Dataset_README.docx file */ /* bottom/left corner */ %let bottom_long=-93.5673; %let bottom_lat=42.1609; /* top/right corner */ %let top_long=-93.1923; %let top_lat=42.3017; data anno_image; length function $8 style $20 imgpath $100; xsys='2'; ysys='2'; hsys='3'; when='b'; flag=2; function='move'; x=&bottom_long; y=&bottom_lat; output; function='image'; x=&top_long; y=&top_lat; imgpath="&map_bw"; style='fit'; output; run; /* a fake map area, to guarantee the extents of the map are covered */ /* (only needed when image area is bigger than map area) */ data my_map; map_id=0; x=&bottom_long; y=&bottom_lat; output; x=&top_long; y=&bottom_lat; output; x=&top_long; y=&top_lat; output; x=&bottom_long; y=&top_lat; output; run; data combined; set my_map anno_image matches; run; proc gproject data=combined out=combined dupok eastlong degrees; id map_id; run; data my_map anno_image matches; set combined; if flag=1 then output matches; else if flag=2 then output anno_image; else output my_map; run; /* turn matches into an annotate dataset of markers on the map */ data matches; set matches; xsys='2'; ysys='2'; when='a'; function='label'; style='albany amt/unicode'; text='25cb'x; size=1; /* color='red'; */ color='Aff000055'; /* v9.3 transparent red */ run; data anno_weather; set mydata.weather; length function $8 color $20 text $20; xsys='3'; ysys='3'; position='5'; when='a'; hsys='3'; x=50; y=50; function='label'; size=20; style="marker"; text='F'; /* direction arrow (pointing to right, for angle=0) */ color='a007FFF55'; /* transparent blue */ /* angle was calculated previously, to go along with wind direction */ run; %macro do_map(date); data temp_matches; set matches (where=(date="&date"d)) anno_weather (where=(date="&date"d)); run; goptions noborder; goptions cback=white; goptions gunit=pct htitle=16pt htext=11pt ftitle="arial/bold" ftext="arial"; goptions xpixels=1100 ypixels=700; title1 ls=1.5 "Location of microblogs containing 'flu-like' keywords..."; title2 "(flu, fever, chill, sweat, ache, pain, fatigue, cough, breathing, nausea, vomit, diarrhea)"; title3 ls=1.3 "&date"; footnote1 j=l c=cx007FFF font="albany amt/bold" "Blue Arrow = wind direction"; pattern v=e color=gray99; proc gmap map=my_map data=my_map anno=temp_matches; id map_id; choro map_id / levels=1 nolegend coutline=graydd anno=anno_image des='' name="&name"; run; %mend; goptions device=png; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title='IEEE VAST Challenge 2011 - mini-challenge 1') style=sasweb; %do_map(16may2011); %do_map(17may2011); %do_map(18may2011); %do_map(19may2011); %do_map(20may2011); quit; ODS HTML CLOSE; ODS LISTING;