%let name=mall_stores; /* This example uses the new SAS 9.4 gif animation syntax, so that the annotated image will be smooth, rather than 'dithered'. */ libname here '.'; %macro do_map(spacenum); /* You need a variable you can do "by" processing with, in the map= data set, the data= data set, and the anno= data set therefore I'm duplicating the data, and adding a "by_var" variable, and then combining into 1 data set again */ /* This one's for map= and data= */ data mydata1; set here.mall_map; by_var=1; run; data mydata2; set here.mall_map; by_var=2; run; data mydata; set mydata1 mydata2; run; /* And this one's for the anno= annotated dots */ proc sql noprint; create table interest as select * from here.mall_stores where trim(left(upcase(spacenum))) eq trim(left(upcase("&spacenum"))); create table title_anno as select unique store from here.mall_stores where trim(left(upcase(spacenum))) eq trim(left(upcase("&spacenum"))); quit; run; /* %let store=%left(&store); foofoo */ data interest1; set interest; by_var=1; when='b'; output; run; data interest2; set interest; by_var=2; when='a'; output; run; data interest; set interest1 interest2; run; /* Annotate the titles, so they share the map real estate */ data title_anno; set title_anno; length style $35 text $100 color $10 html $1000; xsys='3'; ysys='3'; hsys='3'; when='a'; position='6'; color='gray33'; function='label'; x=64; y=29; style='albany amt/bold'; size=3; color="gray33"; text=" = "||trim(left(store)); output; function='pie'; rotate=360; size=1.5; x=62; y=29; style='psolid'; color='red'; output; style='pempty'; color='black'; output; function='label'; html='href="http://www.ShopCaryTowneCenterMall.com"'; x=60.5; y=35; style='albany amt/bold'; size=4; color="gray33"; text='Cary Towne Center'; output; run; data mall_pic; set here.mall_pic title_anno; run; filename odsout './mall_maps'; options dev=sasprtc printerpath=gif animduration=.4 animloop=500 animoverlay=no animate=start center nobyline; ods listing close; ods html path=odsout body="&spacenum..htm" (title="Virtual Cary Towne Center mall map (SAS/Graph prototype)") style=htmlblue; goptions xpixels=915 ypixels=770; goptions cback=white; goptions ftitle="albany amt/bold" ftext="albany amt" htitle=4pct htext=2.5pct; title; options nobyline; pattern1 v=s c=white; proc gmap data=mydata map=here.mall_map anno=mall_pic; by by_var; id idnum; choro idnum / nolegend anno=interest coutline=white des='' name="&spacenum"; run; quit; ods html close; ods listing; %mend; options mprint source source2; /* %do_map(1120); %do_map(2208); endsas; */ proc sql; create table loopdata as select unique cat, category, trim(left(lowcase(spacenum))) as spacenum, translate(store,"b4"x,"'") as store from here.mall_stores where spacenum^='' order by category, store; quit; run; filename odsout '.'; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Virtual Cary Towne Center mall map (SAS Prototype)") style=minimal; /* Print a table at the top of the page, with drilldowns to the anchor for each category, or the individual map for each store */ data tabldata; set loopdata; length link $ 300; link='mall_maps/'||trim(left(cat))||'.htm'; length link2 $ 300; link2='mall_maps/'||trim(left(lowcase(spacenum)))||'.htm'; run; title; data tabldata; set tabldata; length link $300 href $300; label link='Select a Category to Map...'; href = 'href="' || trim(left(link)) || '"'; link = '' || htmlencode(trim(category)) || ''; length link2 $300 href $300; label link2='or Select a Store to Map...'; href = 'href="' || trim(left(link2)) || '"'; link2 = '' || htmlencode(trim(store)) || ''; run; options nocenter; proc report data=tabldata; column link link2; define link / group; run; quit; ODS HTML CLOSE; ODS LISTING; data _null_; set loopdata; call execute('%do_map('|| spacenum ||');'); run; quit;