Announcement

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

  • unmatched quote r(198);

    Hi, Below is my code, and it always generates a warning: "unmatched quote r(198)." How can I resolve this issue?

    global sheets "A" "B" "C" "D" "E"
    foreach sheet in $sheets {
    forvalues i=2016(1)2022 {
    import excel "$DR//`i'.xlsx",clear sheet("`sheet'(`i')") firstrow
    foreach v of var * {
    cap replace `v' = "." if `v' == "--"
    cap destring `v', replace
    }
    gen year=`i'
    save $DT//temp_`i',replace
    }

    use $DT//temp_2016,clear
    forvalues i=2016(1)2022 {
    append using $DT//temp_`i'
    }
    save $DT//`sheet'.dta,replace
    forvalues i=2016(1)2022 {
    cap erase $DT//temp_`i'.dta
    }
    }

  • #2
    it is very hard to proofread such issues; but -trace- may help; see
    Code:
    h trace
    you may want to set tracedepth to 1 at least to start

    Comment


    • #3
      Thinks!

      I solved it because I should add double quotation marks ("") between "A" "B" "C" "D" "E"

      Last edited by Rita Xu; 09 Oct 2023, 08:33.

      Comment

      Working...
      X