The current maps.counties uses counties instead of the planning regions as implemented by Connecticut around the 2023 timeframe. I need to make a Connecticut map using planning regions.
You can download this publicly available shapefile and import it into a SAS dataset using PROC MAPIMPORT.
https://geodata.ct.gov/datasets/ctmaps::ct-planning-regions-1/explore?location=41.516459%2C-72.76175...
Remember to create a library other than work to store the resulting imported data set or you will have to re-import the data.
The shape file is in projected coordinates for Connecticut State Plane (EPSG:6434). This is a bit ugly, as we don't have a lookup for that code available, but this will convert it to lat/lon degrees:
proc gproject data=ct out=newct proj=proj4 to="EPSG:4326" from="+proj=lcc +lat_0=40.8333333333333 +lon_0=-72.75 +lat_1=41.8666666666667 +lat_2=41.2 +x_0=304800.609601219 +y_0=152400.30480061 +ellps=GRS80 +units=us-ft +no_defs"; id PlanningRe; run;
I used "PlanningRe" as the ID as that seemed easier to link to later. You could use "OBJECTID" if you wanted. Depends on what you used in MAPIMPORT.
Let me know if I can be of any more assistance.
BTW, I looked in the .prj file from the shapefile download to get an approximation of what projection was being used. Then I went to https://spatialreference.org and searched for "connecticut" to get a list of projections they use regularly. Then it was a matter of matching up the Esri WKT strings. Wish there was an easier way, but it may help down the road if you run into importing and projection issues in the future.
When using the new CT imported from the shapefile, it is already projected, there you will not need to run the "proc gproject" on it (unless you want some other projection, in which case you can use Jeff's suggestion to deproject and get the lat/long values, so you can re-project it using any projection you want).
Here is a simple example of importing the shapefile, and plotting the already-projected map:
proc mapimport datafile="/home/u59782200/data/CT_Planning_Regions/CT_Planning_Regions.shp" out=raw_ct;
run;
proc gmap data=raw_ct map=raw_ct;
id ObjectID;
choro planningRE;
Also, I notice that your title mentions maps.counties. Note that the 'maps' library is the old/legacy SAS maps (perhaps from 1996 vintage), and you'll probably want to use the latest 'mapsgfk' library instead (for your maps other than CT). Specifically mapsgfk.us_counties (the dataset label indicates this map is based on 2021 map data in the version of SAS I'm using).
Dive into keynotes, announcements and breakthroughs on demand.
Explore Now →Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.