BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BPedersen
Calcite | Level 5

I have been tasked with identifying the US representative for a 3mm dataset of addresses and I am trying to find a databse that may help.  The closest that I have found is this website (http://www2.census.gov/geo/docs/maps-data/data/rel/zcta_cd111_rel_10.txt), but most zip codes have multiple district capabilities.  

 

Does anyone know how I could extract the data that a website like THIS uses? - https://www.govtrack.us/congress/members/map

1 ACCEPTED SOLUTION

Accepted Solutions
Darrell_sas
SAS Employee

Do you want a ZIP Code/ZCTA file or a Congressional District?  They are different.  The Congressional District doesn't pay any attention to the ZIP Code so it may split a ZIP Code.  It seems you want a Congressional District.

 

I think this location has the boundary files for the Congressional Districts:

https://www.census.gov/geo/maps-data/data/cbf/cbf_cds.html

 

You can use Proc MAPIMPORT to read the SHP file (of the congressional district).

Then change your addresses to a Lat/Long with Proc GEOCODE.

If you are just mapping the locations, then use Proc GMAP with your congressional district map and Annotate the location points.

If you want to find out what congressional district that an address falls in, you can use Proc GINSIDE with the addresses and the congressional map and it will identify the congressional district that each location point falls into.

 

I hope that helps.

 

View solution in original post

6 REPLIES 6
Reeza
Super User

Usually I would use QGIS for a project like this. 

 

You'll need to find the SHP file for the boundaries and then geocode your addresses -  Proc geocode. 

 

I'm not sure how you'll determine if an address is in a polygon though. 

Darrell_sas
SAS Employee

Do you want a ZIP Code/ZCTA file or a Congressional District?  They are different.  The Congressional District doesn't pay any attention to the ZIP Code so it may split a ZIP Code.  It seems you want a Congressional District.

 

I think this location has the boundary files for the Congressional Districts:

https://www.census.gov/geo/maps-data/data/cbf/cbf_cds.html

 

You can use Proc MAPIMPORT to read the SHP file (of the congressional district).

Then change your addresses to a Lat/Long with Proc GEOCODE.

If you are just mapping the locations, then use Proc GMAP with your congressional district map and Annotate the location points.

If you want to find out what congressional district that an address falls in, you can use Proc GINSIDE with the addresses and the congressional map and it will identify the congressional district that each location point falls into.

 

I hope that helps.

 

Doc_Duke
Rhodochrosite | Level 12

Good luck.  North Carolina's congressional districts have been so gerrymandered that I would not be surprised if there were single addresses that are in two districts!

BPedersen
Calcite | Level 5

Thank you Darrell, this code worked perfectly! 🙂

dantaylor87
Calcite | Level 5

Hello-I'm attempting to replicate this.  I have the the Census data w/ congressional district boundaries in X, Y; and my addresses geocoded into X, Y.  I'm just not familiar with proc ginside--could anyone help with the syntax? 

 

Forgive if stupid question--very much a beginner.  

Reeza
Super User

Check the documentation for a fully worked example

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1897 views
  • 0 likes
  • 5 in conversation