I have a dataset downloaded from the IRS reporting AGI by ZIP code (link: irs.gov). However, I'm interested in tying each ZIP code to statistical areas (whether it's [a] primary statistical area, [b] combined statistical area, [c] core-based statistical area, [d] metropolitan statistical area, or [e] micropolitan statistical area). Having all of them in one dataset would be ideal, but I'd settle for just CBSA.

I found a great "crosswalk" dataset on the HUDUser website (link: huduser.gov) that does exactly this--connects ZIP code to CBSA. I merged the two files in SAS on ZIP code and voila, most of my problems were solved. But I realized that there were some blaring issues with the merged dataset; for instance, Los Angeles was characterized by different CBSA codes in each file, amongst other errors. I went back to the download sites (both the AGI by ZIP code dataset from the IRS as well as the HUDUser ZIP code to CBSA dataset) and noticed that they were different dates--2014 and 2016Q3 (HUDUser datasets are updated quarterly), respectively. Of course, this could have been the issue, so I tried a date that was closer to 2014 (2013Q4, which was updated 2013-12-22). Fewer errors this time, but still many errors.

Can anyone weigh in on this? How can I ensure that there is no mis-match between CBSA coding on my IRS dataset and my HUDUser dataset? Or, is there another "long" dataset that contains all statistical areas by ZIP code, where each valid ZIP code is a row in the dataset?


I think that you can get what you want from two resources:

  1. The R package noncensus contains a data set called zip_codes that lists the following features for each zip code:
    • zip. U.S. ZIP (postal) code
    • city. ZIP code’s city
    • state. ZIP code’s state
    • latitude. ZIP code’s latitude
    • longitude. ZIP code’s longitude
    • fips. County FIPS Code

So you can get zip code to FIPS. This same package also maps counties to FIPS codes.

  1. The National Bureau of Economic Research provides a downloadable CBSA to FIPS crosswalk. So you should be able to use that to go Zip-to-FIPS-to-CBSA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.