Skip to content

R Map using SAS data

3 messages · Junjie Zhang, Roger Bivand, Michael Friendly

1 day later
#
Junjie Zhang <thujacky <at> hotmail.com> writes:
It is always a good idea to look at the Task Views on CRAN. In the Spatial 
Task View, you'll find a description of what you can do using contributed
packages, but - as you would see be reading the links - this does not
include SAS map data (it is possible that you are not supposed to either,
have you checked?). 

The Task View also points to a special interest list which would probably 
be more relevant for you question, but I'm afraid that finding appropriate 
free geodata sources is generally much harder than plotting the maps.

Roger Bivand
2 days later
#
Junjie,

SAS map datasets are just ordinary data sets containing variables X, Y 
(lat/long), a region ID variable, perhaps a DENSITY variable (used to
select lower-resolution versions), and perhaps a SEGMENT variable
if a region has two or more disconnected polygons.

For some maps, there is another dataset containing additional 
information about each region; e.g., for France, there is
a maps.france2 containing the name of each department and other
stuff.

Use proc contents to see what is there:

proc contents data=maps.france; run;
proc contents data=maps.france2; run;

I have a SAS macro, map2gen, that converts these to ArcView 'generate'
format,
http://www.math.yorku.ca/SCS/sasmac/map2gen.html

Your mileage may vary, but hope this helps.

You should know that SAS map datasets are proprietary (``not free'') and
they are provided in an arbitrary (and non-public) coordinate system.
You can do a wide variety of different map projections with proc 
gproject, but, AFAIK, you won't know exactly what coordinate system
you have in any map you can export. This only matters if you want to
use tools in the sp package that depend on knowing the proj4 string
that identifies the details of a particular map projection.

In general, you'll more & better help if you subscribe & post to r-sig-geo.

-Michael
Junjie Zhang wrote: