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.
When I run this particular data set, using my laptop, and the
'debug' (non-optimized) R&D SAS, it takes about 10 minutes
(presumably the optimized/customer image will be a bit faster!).

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!  Also, this brute-force
technique is a bit slow.)

Back to Samples Index