Closed c-zippel closed 1 year ago
Actually this is not fully fixed by https://github.com/CenterOnBudget/getcensus/commit/aa1294f5445c495bbf9509c98ce0d3f30b7eeef8.
Even if statefips() is not specified with geography(zcta), you'll get an error because a state variable is assumed to be in the retrieved data.
See https://gahwan.com/stata-getcensus-package-for-american-community-survey-datasets/
I ran:
getcensus B19013_001, sample(5) statefips(23) geography(zcta) year(XXXX) clear
, testing four different years.
When I specified 2018 and 2019 for the year, the data downloaded successfully. When I specified 2020 and 2021, I got the following error message:
Starting with the 2020 5-year estimates, statefips() may not be specified with geography(zcta) for the product type you have requested.
Update: I tested the same code without specifying statefips
, again trying four years:
getcensus B19013_001, sample(5) geography(zcta) year(XXXX) clear
2018 & 2019: Successfully retrieved vars year
state
zipcodetabulationarea
name
b19013_001e
b19013_001m
2020 & 2021: Successfully retrieved vars year
zipcodetabulationarea
name
b19013_001e
b19013_001m
(no state
var and no error message)
I see the following note in the supported geography section of the documentation, on the statefips
option with zcta
:
† may not be specified starting with the 2020 5-year estimates (2019 for subject tables).
The issue as written above notes that the change began in 2019 for detailed tables, but I think subject tables must be right given my testing of a detailed table above and my running the following:
getcensus S2001_C01_001, sample(5) statefips(23) geography(zcta) year(XXXX) clear
When I specified 2018 for the year, the data loaded successfully. When I specified 2019, 2020, and 2021, I got the following error:
Starting with the 2019 5-year estimates, statefips() may not be specified with geography(zcta) for the product type you have requested.
Eliminating the statefips()
option in the above code successfully retrieves data for all years, with the state
var missing for 2019 on.
So, I think this looks good! Just let me know if you'd like me to check any other product types.
Thanks Stephanie! I did indeed get the table type wrong in the issue but right in the fix & documentation
Starting with the 2020 5-year estimates, the Census API no longer supports specifying state FIPS codes with the ZCTA geography. (For some reason, for detailed tables, this isn’t supported starting with the 2019 5-year estimates).