Announcement

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

  • Dumb/quick question regarding importing csv files

    I am banging my head trying to import csv file, or any csv file, but I keep getting.

    import delimited C:\...\Most+Recent+Cohorts+(Scorecard+Elements).cs v
    invalid '('
    r(198);


    My CSV gets this error, and so does this (https://s3.amazonaws.com/ed-college-...+Elements).csv), but not this (https://data.cityofnewyork.us/api/vi...sType=DOWNLOAD). Both latter sets from here (https://catalog.data.gov/dataset?res_format=CSV)

    The csv files look similar.

  • #2
    Naturally, I can't test anything on a file on your C: drive. However, I find that

    Code:
    import delimited using "https://s3.amazonaws.com/ed-college-choice-public/Most+Recent+Cohorts+(Scorecard+Elements).csv"
    works fine for me. Without the quote marks, Stata chokes on the first parenthesis. So, even though there are no spaces the " " insist to Stata that it's all one file name.

    I don't remember ever seeing parentheses in filenames before, but ignorance is sometimes just ignorance. I would have guessed that they weren't legal everywhere.

    Comment


    • #3
      Parentheses can be quite (British sense) common in file names among computer beginners. I am guessing that the most common use of parentheses in filenames is (2) at the end of the base name of the file. This is typically the result of "Copy, but keep both files" in Windows. For example, say you have file "test.txt". Then, the file you are copying will be renamed "test (2).txt".

      Comment


      • #4
        Indeed; now that I think about it I've seen that hundreds of times. Thanks.

        Comment


        • #5
          Looks like the issue was the quotes thanks. This begs the question why Stata would output without quotes when you use the GUI (File>import).

          Comment


          • #6
            The rules here are driven by Stata's need to understand your input. People can see that some filename just includes some spaces, but that is a harder job for Stata to parse when other information may be given on the same command line.

            Comment

            Working...
            X