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
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.
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.
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.
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!
Thank you Darrell, this code worked perfectly! 🙂
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.
Check the documentation for a fully worked example
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.