Announcement

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

  • problems reading filename consisting of compound of locals

    I try to process my data files, calling them in a loop, but I get an error message r(601) saying that the file cannot be found. The files do exist in the file path provided. I think it concerns the combination of locals in the file's name. Any clue to solve it?


    local file main spouse all
    local year 2016 2015

    foreach i in `file' {
    foreach j in `year' {
    use "I:\project_charles_nick\data\`i'_`j'.dta" , clear
    ........................
    .......................
    }
    }

  • #2
    To learn how to get help in diagnosing problems, see -help set trace-.

    In the current situation, you are getting caught by the behavior of the "" ("backslash") character, which in Stata and other languages can function as an "escape" character. Use "/" instead in filenames, even for Windows systems. See this page to learn about avoid problems with the "".

    Comment


    • #3
      Thanks for your comment, Mike. I appreciate it

      Comment

      Working...
      X