CenterOnBudget / getcensus

Load American Community Survey data from the U.S. Census Bureau API into Stata
https://centeronbudget.github.io/getcensus/
MIT License
14 stars 3 forks source link

error message "variable state not found r(111);" after any #55

Closed martinjbraun closed 2 years ago

martinjbraun commented 2 years ago

Describe the bug Any time I use this command I get the same error message "variable state not found r(111);"

To Reproduce getcensus S1701_C02_001 S1701_C03_001, years(2015/2019) statefips(51) clear Output is :

"(1 var, 14 obs) Link to data for 2015 (1 var, 14 obs) Link to data for 2016 (1 var, 14 obs) Link to data for 2017 (1 var, 14 obs) Link to data for 2018 (1 var, 14 obs) Link to data for 2019 variable state not found r(111);"

Stata version 17.0 SE running on UNIX server

Expected behavior I got this example off of statlist https://www.statalist.org/forums/forum/general-stata-discussion/general/1632583-new-package-getcensus-on-ssc-load-american-community-survey-data-from-the-census-bureau-api-into-stata

and expect it to: "Load ACS variables S1701_C02_001 (population in poverty) and S1701_C03_001 (poverty rate) for the state of Virginia (FIPS code 51) for the most recent five years"

I get the same error message any time I run a getcensus command

*Notes It looks like someone else mentioned this problem on statlist, but I don't see a solution. This command would be amazing if it works! Thanks!

c-zippel commented 2 years ago

Thanks @martinjbraun for filing. I'm trying to reproduce the issue on my end but can't seem to get the error. Would you mind running the following:

set trace on
set tracedepth 2
getcensus S1701_C02_001 S1701_C03_001, years(2015/2019) statefips(51) clear

And send me the output?

martinjbraun commented 2 years ago

getcensus.log

Here is my log. I replaced my actual census key with "\~censuskey\~"

c-zippel commented 2 years ago

Thanks! A head's up that may take me a while to pinpoint and resolve this bug, as it could be an operating system issue and I currently only have access to Windows and OSX.

martinjbraun commented 2 years ago

I ran the same code on Windows and am getting the same error. See the log attached.

getcensus_windows.log .

c-zippel commented 2 years ago

Thanks for the additional info. Not an OS issue then. When you click the link "Link to data for 2015" or any of the other years, do you see a message about an invalid API key?

martinjbraun commented 2 years ago

Yes! I never clicked "click here to activate your key" when I requested the API key. Everything works now that I have a valid API key. Sorry for the trouble!

c-zippel commented 2 years ago

No worries! This was a useful exercise. Now I know that getcensus will not throw a useful error if the API key is invalid. I'll aim to fix that in the next version.