Click here to see the SAS code. 
Click here to see the example.

I started with an example in the book
"The Encore Series, SAS/Graph Software", p. 141.
It was originally from Observations, First Quarter 1994.

I decided to try to do a similar map, but doing the entire
US map (instead of just one small section).

Here's how I got the data ...

-----

   http://www.ngdc.noaa.gov/mgg/gdas/gd_designagrid.html
   Your Grid Id: bobsas1
   Grid Database: ETOPO2 - 2-minute global relief
   x - Windows
   Lat/Lon (left defaults - lat(up/down) = 50N-25N , lon (across)=125W-67W
   Cell size - 10-minute  (the 2-minute is too big to handle on a pc)
   Cell params - default (2-byte integers, whole meters precision)
   Format: XYZ (lon,dat,depth), No Header, Space delimited, omit empty grid cells

   Clicked 'Design-A-Grid' button.
   Clicked 'Next-->' button
   Clicked 'Compress and Retrieve' button
   Clicked 'Retrieve' button
   Clicked 'save'
   Saved bobsas1.zip to my U:
   Then, after saving it, I unzipped it, which created a directory structure...
   There's a lot of 'junk', but the file I wanted was ...

      /u/realliso/bobsas1_data/bobsas1/bobsas1.xyz
      (I renamed that to topo_10min.dat)

-----

I read this elevation data into a sas data set, and convert the long/lat 
values from degrees into radians, and then multiply longitude by -1.
Now the coordinates match up with the sas/graph maps.states map
that I'm going to use.

I then convert the elevation data set into a sas/graph annotate data set.
For each observation, I create a small 1-slice solid-color annotate "pie".
I then color the pie based on which elevation range it's in (the mountains
are shades of brown, the 'flatlands' are shades of green, and anything 
with a negative elevation below sea level is blue).

I then combine my annotate data with maps.states, and then do a map projection.
By projecting them together, that guarantees the map and the annotated elevation
colors will line up correctly.  After projecting them, I separate the map from
the annotate data set, and use "proc gmap" to draw an empty/outline of the us 
map, and annotate my elevation colors behind the map.  I also use annotate 
to draw a custom map color legend.

And, to add a "special touch", I use the gmap html= option to add an html
title= text charttip/flyover-text with the state name, and href= is coded
to allow the user to click on the state and drilldown to the National
Geophysical Data Center's page that shows their very-detailed 3d elevation
contour maps.

Back to Samples Index