Syntax
Retrieve ACS Data
Syntax
variable IDs, table ID, or keyword} [, options] getcensus {
Variable IDs | If a list of variable IDs is specified, the variables must come from tables that share the same product type (Data Profile, Subject Table, Comparison Profile, or Detailed Table). For information about ACS tables and product types, see Table IDs Explained on the Census Bureau website. Do not not suffix variable IDs with “E” (for estimate) or “M” (for margin of error). |
Table ID | Only a single table ID may be specified. |
Keyword | A curated set of variables. See Keywords. |
Options
For a complete description of options, see Options.
Main
years(numlist)
year(s) to retrieve; default is the most recent available.
sample(integer)
1, 3, or 5; default is 1.
geography(string)
geography to retrieve; default is state.
key(string)
your Census Bureau API key.
nolabel(string)
do not label variables with associated metadata from the API data dictionary.
noerror
do not retrieve margins of error associated with estimates.
saveas(filename)
save retrieved data as a Stata dataset.
exportexcel
if saveas()
is specified, also save retrieved data as an Excel spreadsheet.
replace
if saveas()
is specified, overwrite existing files.
clear
replace the data in memory, even if the current data have not been saved to disk.
browse
browse the retrieved data in the Data Editor after getcensus completes.
Geography Options
statefips(string)
state FIPS codes of states to retrieve; default is usually all.
countyfips(string)
county FIPS codes of counties to retrieve; default is usually all.
geoids(string)
GEOIDs of geographies to retrieve; default is usually all.
geocomponents(string)
geographic component codes of geographies to retrieve.
Advanced Options
cachepath(string)
customize where getcensus caches API data dictionaries.
Search the API Data Dictionary
Syntax
getcensus catalog [, options]
Options
For a complete description of options, see Options.
Main
years(numlist)
year(s) to retrieve; default is latest available.
sample(integer)
1, 3, or 5; default is 1.
product(string)
load the API data dictionary for estimates of given product type.
table(string)
load the API data dictionary for estimates in a given table.
search(string)
load the API data dictionary for estimates with descriptions matching a search term.
clear
replace the data in memory, even if the current data have not been saved to disk.
browse
browse the retrieved data in the Data Editor after getcensus completes.
Advanced Options
cachepath(string)
customize where getcensus caches API data dictionaries.