%let name=crabtree_categories; goptions xpixels=900 ypixels=860; libname here '.'; /* sas crabtree_build.sas sas crabtree_categories.sas sas crabtree_ods.sas sas crabtree_stores.sas */ /* Macro do draw a mall map showing all stores in a shopping category */ %macro do_cat(cat); proc sql noprint; create table interest as select * from here.crabtree_stores where cat eq "&cat"; select unique translate(category,"b4"x,"'") into :category separated by "" from here.crabtree_stores where cat eq "&cat"; quit; run; filename odsout './crabtree_maps/'; GOPTIONS DEVICE=png; ODS LISTING CLOSE; ODS HTML path=odsout body="&cat..htm" (title="Virtual Crabtree Valley Mall map - (SAS Prototype)") style=minimal ; goptions ftitle="arial/bo" ftext="arial" htitle=4pct htext=2.5pct; goptions cback=white; pattern1 v=s c=white; title1 link="http://www.crabtree-valley-mall.com" "Crabtree Valley Mall"; title2 font='wingdings 2' color=red 'ea'x font="arial/bold" color=black " = &category"; proc gmap data=here.crabtree_map map=here.crabtree_map anno=here.crabtree_pic; id idnum; choro idnum / nolegend anno=interest coutline=white des="" name="&cat"; run; quit; ODS HTML CLOSE; ODS LISTING; %mend; /* First, create a page of links to the maps ... */ filename odsout '.'; GOPTIONS DEVICE=png; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Virtual Crabtree Valley Mall map (SAS Prototype)") style=minimal ; goptions ftitle="arial" ftext="arial" htitle=15pt htext=12pt; goptions cback=white; proc sql; create table cats as select unique cat, category from here.crabtree_stores order by category; quit; run; data all; cat='all'; category='All Stores'; run; data cats; set cats all; run; /* Print a table/report with drilldowns to the anchor for each category */ data cats; set cats; length link $ 300; link='crabtree_maps/'||trim(left(cat))||'.htm'; run; title; data cats; set cats; length link $300 href $300; label link='Select a Category to see Mall Map...'; href = 'href="' || trim(left(link)) || '"'; link = '' || htmlencode(trim(category)) || ''; run; options nocenter; proc report data=cats; column link; run; quit; ODS HTML CLOSE; ODS LISTING; /*-------------------------------------------------------------------------------------*/ /* Now, loop through all the categories, and create the map for each (by calling the macro) */ options mprint source source2; options center; title; data _null_; set cats (where=(cat^='all')); call execute('%do_cat('|| cat || ');'); run; /* Now, show all the stores on one map (I guess I could have modified my macro to look for category=all and do this special map, but it seemed easier just to do it separately.) */ proc sql noprint; create table interest as select * from here.crabtree_stores; quit; run; filename odsout './crabtree_maps/'; %let cat=all; GOPTIONS DEVICE=png; ODS LISTING CLOSE; ODS HTML path=odsout body="&cat..htm" (title="Virtual Crabtree Valley Mall map (SAS Prototype)") style=minimal ; goptions ftitle="arial" ftext="arial" htitle=15pt htext=12pt; goptions cback=white; pattern1 v=s c=white; title1 link="http://www.crabtree-valley-mall.com" "Crabtree Valley Mall"; title2 font='wingdings 2' color=red 'ea'x font="arial/bold" color=black "All Categories"; proc gmap data=here.crabtree_map map=here.crabtree_map anno=here.crabtree_pic; id idnum; choro idnum / nolegend anno=interest coutline=white des="" name="&cat"; run; quit; ODS HTML CLOSE; ODS LISTING;