6

I want to use the USA American Community Survey Data for spatial analysis, but I'm having difficulty understanding how the survey tables are constructed so that I can relate them to block-group shapefiles.

I've successfully made a shapefile that contains all the US blockgroups, but I can't figure out how the census data is related to it using the STFID code. I have a few thousand text files (named e20095ak0001000.txt for example). When I read them into R they appeared with the following headers:

[1] "ACSSF"    "X2009e5"  "ak"       "X000"     "X0011"    "X0000001"
[7] "X4269"    "X2211"    "X224"     "X157"     "X189"     "X142"    
[13] "X77"      "X269"     "X247"     "X169"     "X389"     "X146"  ... up to 200 or so

(I'm assuming the blockgroup code does not match the filename, as I have 12,465 files and 212,083 blockgroups)

I realize I need to figure out what the the ID code is, to link these to the block groups, but I can't find documentation that explains this information (even after reading the technical documentation). Where are these column headers explained?

I am using the 5 year ACS survey.

2
  • Just to clarify, I'm interested in analyzing this data at the blockgroup level which is not available via the American FactFinder.
    – djq
    Commented Jul 23, 2011 at 14:25
  • The technical documentation explains the record layouts for the 2005 - 2009 ACS data and includes some instructions and tools for importing into SAS or Excel. www2.census.gov/acs2009_5yr/summaryfile/…
    – Sean
    Commented Jul 25, 2011 at 19:43

1 Answer 1

10

You want to assemble a nationwide set in one file? For how many variables?

There are a few hoops to get over to actually connect the STFIDs in your shapefile with the data. I couldn't read if your primary problem is decoding the naming schemes of the files and figuring out what is in each, or if it was about relating the primary keys of the shape file and data files. At any rate, here is one way. I must say that I refer to the ACS 2005-2009 sample, but it seems the structure is analogous:

  • Get the data file. Sounds like you downloaded the entire nationwide dataset? The one you refer to is from ACS 2009, Alaska, segment 0001 (because there are so many fields in the ACS summary file, the bureau segments them into more than 100 separate files for the estimates and 100 additional files containing margins of errors. These files have an "m"-prefix (for each state).
  • You will need the table headers, too. For ACS they are stored in xls files.
  • STFID is one way to uniquely refer to a block group. Another is LOGRECNO, which is the field actually found in the data files. You need to relate that using one of the geo files (also xls). For instance, the california one is here. STFID is a shorter version of column C (the last 15 or so characters; don't remember the exact number for block groups, but it identifies a two digit code for state, a three digit code for county, a six digit code for tract, and a (I think) four one digit code for block group). For example, a block group in San Francisco would be 060750101001 or so.
  • If you are only interested in a handful of variables it is a lot easier just to fetch those tables from American Factfinder. I think most ACS surveys are now on factfinder2.
  • lastly, when I was dealing with this, I found this document useful, albeit for the five year sample. This one is available for the 1-year sample.
10
  • Thank you Aksel - that is very helpful. I did download the entire dataset, I was assuming I can loop through each text file and pull out the relevant variable. My problem was/is actually both decoding the naming schemes, and figuring out what is in each. I did not realize the xls headers that you linked to matched up with each text file based on position; when I started reading data into R it appended an X to each value which I thought was a code I need to relate to.
    – djq
    Commented Jul 23, 2011 at 13:10
  • I did all the imports to an access database using a python script to loop through the folder of table sequence headers and then fetch the appropriate data file for each and splice them together, but that worked because I was concentrating on 9 counties. The nationwide set wouldn't fit. Of course if you have a list of variables that is a lot smaller than the total 114 sequences that makes it more manageable.
    – ako
    Commented Jul 23, 2011 at 16:32
  • Also, you may have seen this, but a good portion of variables are not available at the block group level.
    – ako
    Commented Jul 23, 2011 at 16:33
  • And lastly, the I might add that the python script I wrote for importing all sequences with headers into a db did use pyODBC so I tested it with a mysql database as well which wouldn't have the same size limitations as Access. I am happy to share, but it would probably need a fair amount of tweaking to work with a nationwide set and the ACS-1 year set as opposed to the 5-year sample.
    – ako
    Commented Jul 23, 2011 at 19:04
  • 1
    Block Group numbers are one digit, they are the same as the first digit of all Blocks in that BG and frequently reported combined with the tract number. E.g. In county 888 of state 77 the code for BG 1 of Tract 999900 is 9999001. If there are 4 blocks in BG 9999001, they might be numbered 1001, 1002, 1003 and 1004. The full code for block 1001 would be 778889999001001.
    – Sean
    Commented Jul 25, 2011 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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