Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Importing .txt file from a website to Stata

    Hi,
    Below is a website that is hosting a .txt file. I would like to download the data directly from the website into Stata.


    https://www2.census.gov/geo/docs/map...nty20_natl.txt

    I used the website below as a reference.

    https://www.stata.com/links/stata-ba...-data-website/

    This is the command I tried but it was not successful.

    Code:
    infix using "https://www2.census.gov/geo/docs/maps-data/data/rel2020/zcta520/tab20_zcta520_county20_natl.txt"
    Does anyone know how to get this data into Stata? Thanks.

  • #2
    The file in question is not a fixed-format text file. It is delimited, by |. So -infix- cannot deal with it.
    Code:
    import delimited using https://www2.census.gov/geo/docs/maps-data/data/rel2020/zcta520/tab20_zcta520_county20_natl.txt
    does it for you.

    Comment

    Working...
    X