Announcement

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

  • Unrecognized characters in filename when importing using: "local myfiles: dir "directory" files "*.csv"

    Hello!

    I have a file named "abc+def+mm+dd+yyyy.csv" in directory "$path/survey responses". The file is being downloaded directly from Qualtrics and I want to not have to change the file name.

    However, when I run the following code:
    Code:
    local myfilelist : dir "$path/survey responses" files "*.csv"
    foreach file of local myfilelist {
        
        di in red "`file'"
        import delimited using "`file'" , clear varnames(1) 
    }
    the code is unable to find the correct file to import because this line of code "local myfilelist : dir "$path/survey responses" files "*.csv"" removes the plus signs and interprets it as "abc def mm dd yyyy.csv".
    Is there anything I can do to solve this?
    Perhaps, is there another way I can import an arbitrary file name from a specific directory?

    Thanks for the help everyone!




  • #2
    Duplicate post. See https://www.statalist.org/forums/for...tory-files-csv.

    Comment

    Working...
    X