%let name=observatories; filename odsout '.'; /* Using data from: http://www.arcetri.astro.it/~kreardon/EGSO/gbo/observatory.list.28Sept2002.pdf (note that he has his long/lat variables reversed) */ PROC IMPORT OUT=observatories DATAFILE="observatories.xls" DBMS=XLS REPLACE; GETNAMES=YES; run; data observatories; set observatories; anno_flag=1; lat=.; lat=scan(latitude,1,' '); long=.; long=scan(longitude,1,' '); if substr(longitude,length(longitude))='W' then long=long*-1; if substr(latitude,length(latitude))='S' then lat=lat*-1; if location^='' and lat^=. then output; run; /* This one had lat=9.2 ... which user Carl Martin pointed out is wrong (off the coast of the Philippines). So I'm hard-coding the Google Maps lat/long. */ data observatories; set observatories; if observatory='Bohyunsan Optical Astronomy Observatory' then do; lat=36.1647516; long=128.9768266; end; run; /* Get the world map, leave out antarctica */ data world; set mapsgfk.world (where=(density<=1 and idname^='Antarctica') drop=resolution); run; /* combine, project, and separate */ data combined; set world observatories; run; proc gproject data=combined out=combined latlong eastlong degrees dupok project=gall; id id; run; data world observatories; set combined; if anno_flag=1 then output observatories; else output world; run; data observatories; set observatories; length function style $12 color $8 text $20 html $1024; xsys='2'; ysys='2'; hsys='3'; when='a'; /* This same url will be used in the 'proc gmap' drilldown, and the 'proc tabulate' report */ length href_string $200; href_string='http://www.google.com/search?&q='||trim(left('Observatory, '||trim(left(observatory))||', '||trim(left(location)))); if (index(href_string,'USA') ne 0) then href_string=substr(href_string,1,index(href_string,'USA')-3); /* This is the html title= charttip and href= drilldown for the annotated circle */ html= 'title='||quote( trim(left( trim(left(observatory))||' '||trim(left(location)))))|| ' href='||quote(href_string); /* Draw a pie, to check centering of your letter 'o' */ function='pie'; rotate=360; size=.5; position='5'; color='red'; style='psolid'; output; style='pempty'; color='black'; output; run; /* http://www.fundraw.com/clipart/clip-art/00004169/Mountaintop-Observatory/ */ data logo; length function text color $8; xsys='3'; ysys='3'; hsys='3'; when='a'; imgpath='observatory_image.jpg'; style='tile'; function='move'; x=1; y=3; output; function='image'; x=x+22; y=y+25; output; run; goptions device=png; goptions xpixels=1000 ypixels=650; goptions border; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="SAS/Graph Astronomical Observatory Map") style=htmlblue; pattern1 color=lig; goptions gunit=pct htitle=5 ftitle="albany amt/bold" htext=2.75 ftext="albany amt" ctext=gray; title1 j=left move=(+2,+0) ls=1.2 "Astronomical Observatory Map"; footnote1 j=c ls=2.0 "click dots for more info"; proc gmap data=world map=world anno=observatories; id id; note move=(81,93.5) c=gray font='albany amt' height=2.25 "Data from year 2002"; choro segment / levels=1 nolegend coutline=graybb anno=logo des='' name="&name"; run; /* Proc report needs the drilldowns formatted a little differently than proc gmap ... */ proc sql noprint; create table table_data as select unique observatory, location, href_string, lat, long from observatories; quit; run; data table_data; set table_data; length href_name link_name href_lat_long lat_link long_link $300 longname $200; if trim(left(observatory))='' then longname=trim(left(location)); else longname=trim(left(observatory))||' & '||trim(left(location)); href_name = 'href='||quote(trim(left(href_string))); link_name = ''||htmlencode(trim(left(longname)))||''; href_lat_long = 'href='||quote('http://www.maps.google.com/maps/@'||trim(left(lat))||','||trim(left(long))||',15z'); lat_link = ''|| htmlencode(trim(left(put(lat,comma.1))))||''; long_link= ''|| htmlencode(trim(left(put(long,comma.1))))||''; run; proc sort data=observatories out=observatories; by observatory location; run; title1 h=12pt "Astronomical Observatories"; title2 h=12pt "(click lat/long to see map, click name to see more info)"; footnote; proc print data=table_data noobs label style(data)={font_size=12pt} style(header)={font_size=12pt}; label lat_link='Latitude'; label long_link='Longitude'; label link_name='Observatory @ Location'; var lat_link / style(data)={just=r width=0.4in}; var long_link/ style(data)={just=r width=0.4in}; var link_name; run; quit; ODS HTML CLOSE; ODS LISTING;