Help using Base SAS procedures

Get correct county code

Accepted Solution Solved
Reply
Super Contributor
Posts: 398
Accepted Solution

Get correct county code

I'm working on a geocode process where I have about 400 observations that are zip matches and no county code is returned. 

I used the sashelp.zipcode table to join on zipcode to get the county code.  I thought that would work but I have 2 rows where the county code from sashelp.zipcode doesn't match the latest shapefile for that state. 

 

I was using the county code to subset the shapefile data so running proc ginside wouldn't take as long.  I have to have the data be 100% correct. 

 

Is there a better way to get the correct county or a faster way to run proc ginside.

 


Accepted Solutions
Solution
‎03-08-2017 05:09 PM
Super User
Posts: 10,497

Re: Get correct county code

And the source for your censub block data is what?

If it is the ZCTA stuff from teh census department there are many parts of the country where geography is not included as Zipcode tabulation areas aren't exhaustive, especially in areas with low population density.

 

You may want to check this page: https://www.census.gov/geo/reference/county-changes.html and compare with the date of your information. Some county values have have changed that aren't reflected in the shapefile or vice versa. See things like:

 

Oglala Lakota County, South Dakota (46-102)
Changed name and code from Shannon County (46-113) effective May 1, 2015.

 

View solution in original post


All Replies
Super User
Posts: 17,819

Re: Get correct county code

Have you downloaded the latest map files from SAS Maps online? When you say geocoding are you using PROC GEOCODE?

Super Contributor
Posts: 398

Re: Get correct county code

Reeza,

 

Yes I have the latest street maps from sas that I'm using with proc geocode.  I'm using the latest block shapefiles from the census website and using those with proc ginside to get the block and tract that come back missing from the geocode process.

 

Thank you

Super User
Posts: 10,497

Re: Get correct county code

You may want to check on the SAS site for an updated ZIPcode data set. However it is not uncommon for data entry to create Zip codes that do not actually exist. You might try a city/state match if you have that instead of Zip.

Super User
Posts: 17,819

Re: Get correct county code

Why are these zip codes not matching? Are they correct?

Is there an alternative zip code lookup in the US?

 

I'm in Canada and we get a release file with postal code and centroids from Canada Post every few months but it's out of date frequently. 

Super Contributor
Posts: 398

Re: Get correct county code

It's the counties that are not matching.  I have the latest zipcode data.  I even copied to the sashelp directory so I have the latest one when doing proc geocode.

 

The issue is that the county from sashelp.zipcode doesn't match up with the data from the census block shapefile for that state.

 

 

Solution
‎03-08-2017 05:09 PM
Super User
Posts: 10,497

Re: Get correct county code

And the source for your censub block data is what?

If it is the ZCTA stuff from teh census department there are many parts of the country where geography is not included as Zipcode tabulation areas aren't exhaustive, especially in areas with low population density.

 

You may want to check this page: https://www.census.gov/geo/reference/county-changes.html and compare with the date of your information. Some county values have have changed that aren't reflected in the shapefile or vice versa. See things like:

 

Oglala Lakota County, South Dakota (46-102)
Changed name and code from Shannon County (46-113) effective May 1, 2015.

 

Super Contributor
Posts: 398

Re: Get correct county code

ballardw,

 

The source is this site:

https://www.census.gov/geo/maps-data/data/tiger-line.html

 

I'm using the 2016 block data.

 

I'm going to have to dig deeper into the data and see if it is what you said just a change reflected on one side but not the other.

 

Thank you

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 207 views
  • 0 likes
  • 3 in conversation