Click here to see the SAS code.
Click here to see the example.
---------------------------------------------------------------
This example demonstrates a way to create a dot-density map.
For each map area, I determine how many dots I want to be in
the map area (based on some response data - such as 1 dot for
each 1,000,000 people), a loop through calling my macro that
many times. The macro selects a random x/y coordinate (if the
random x/y coordinate is not in the desired map area, I run
the macro again ... until I pick a random x/y that *is* in
the desired map area).
This is a "brute force" method, and therefore takes a bit of time.
If you don't like how the dots are distributed in your map,
you can change the 'seed' value that is used in the ranuni()
functions, and different random dots will be selected.
(Note that the way I run the macro, which runs a proc & passes
some values back via macro variables ... you'll need SAS 9.3m2
or higher in order to run this code!)
Back to Samples Index