Announcement

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

  • downloading .csv.gz files.

    Dear All,
    I want to download some .cvs.gz files from a Github repository, unzip and save as .dta files. I am trying to run:

    Code:
           foreach d in 22 26 29{
      2.         if `d'<=9 local space "0"
      3.         if `d'>9 local space "" 
      4.         clear
      5.         !gunzip -c "https://githubusercontent.com/COVIDExposureIndices/COVIDExposureIndices/master/lex_data
    > /county_lex_2020-08-`space'`d'.csv" -> "G:\My Drive\Data\placeiq\rawdata\county_lex_2020-08-`spa
    > ce'`d'.dta", replace 
      6.                 }
    A .dta file with the specified name is created but its empty! Not sure what I am doing wrong. I have used the same method to previously import .csv files from the same github page... so it could be that something goes wrong in gunzip? I wish had more information to post... but I get no error message... just an empty file.
    Will be grateful for any insights others may have to offer.
    Sincerely,
    Sumedha.

  • #2
    First, for some reason my web browser is unable to locate the server "https://githubusercontent.com" so I'm shooting in the dark here.

    I want to download some .cvs.gz files from a Github repository, unzip and save as .dta files. I am trying to run:
    Assuming you mean to download a .csv.gz file, it takes more than unzipping it into a file with a .dta suffix to turn it into a Stata dataset. You can download a csv file into a csv file, and then use import delimited to read it into a Stata dataset, and then save to write the dataset from memory into a .dta file.

    Comment


    • #3
      Thank you so much Lisowski! of course... it worked perfectly once I unzipped to csv and then imported to .dta format.

      Comment

      Working...
      X