Hi all

Thanks to Kit Baum, censusapi is now available on SSC. This tool facilitates downloading data through the US census API, which at the time of writing is available for free. Censusapi comes in two shapes. Either you directly specify the correct url, in which case censusapi deals only with the behind the scenes technicalities (establishing the link to the API, cleaning and converting the data returned by the Census).

Alternatively, you can use the dataset/variables/predicate/key variables and let censusapi generate the url. This is not only more convenient for you, it also makes the code much more readable. Moreover, there is some magic behind the variables() option that saves you some headache. For example, you can specify variables(P0110001-P0110031) and it will automatically transform that into P0110001,P0110002,...,P0110030,P0110031. Additionally, if you end up with more than 50 variables (the limit imposed by the Census), censusapi will split the request and merge the output files together.

Example
Code:
    Example 1: the url() way: some info about San Francisco
        . censusapi, url("https://api.census.gov/data/1990/sf1?get=P0010001,ANPSADPI,H0010001&for=place:67000&in=state:6")

    Example 2: the alternative method, illustrating also the variable parsing and saving capacities
        . censusapi, dataset("https://api.census.gov/data/1990/sf1") variables("P0010001 AREALAND P0110001-P0110031 P0060001-P0060005 H0010001 H0230001-H0230020") predicate("for=place:*&in=state:*") destination("test.txt")
As usual, if you encounter any issues or have any feedback; don't hesitate. I have only used this on the 1990 Census data, so I cannot guarantee it will work flawlessly with other datasets.