Announcement

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

  • r(132) too few quotes

    Hi all,

    For the life of me I cannot figure out where the error lies in my code. I was hoping a second set of eyes could help me out.

    Code:
    qui reghdfe dry_yield num_pest_per_hh, a(villgis year)
    outreg2 using coef1.tex, replace title(Dry Yield and Pesticide Use per HH) ctitle(OLS) addtext(Village FE, X, Year FE, X)
    which returns

    "C:\Users\Daniel's PC\ado\plus/o/outreg2.ado
    too few quotes
    too many ')' or ']'
    r(132);
    "
    I am guessing it has to do with where the file is attempting to save, but I can't figure it out. Thank you for reading.

  • #2
    Type

    Code:
    set trace on
    repeat what you have done.

    Then look up what has happened to the point where you see a message in red. This is the offending line.

    Copy the line with say three lines after it, and say 7 lines before it, and paste it here.

    Comment


    • #3
      - di as txt `"`ffn'"'
      = di as txt `"C:\Users\Daniel's PC\ado\plus/o/outreg2.ado"'
      C:\Users\Daniel's PC\ado\plus/o/outreg2.ado
      - if "`all'"=="" {
      = if ""=="" {
      - ret local fn `"`ffn'"'
      = ret local fn `"C:\Users\Daniel's PC\ado\plus/o/outreg2.ado"'
      - exit
      ---------------------------------------------------------------------------------------------------- end findfile ---
      - local place=substr(`"`r(fn)'"',1,`=length(`"`r(fn)'"')-11')
      too few quotes <--------Error 1
      = local place=substr(`"C:\Users\Daniel's PC\ado\plus/o/outreg2.ado"',1,)-11')
      too many ')' or ']' <--------Error 2
      tempname myplace
      cap file open `myplace' using `"`place'outreg2.pref"', write text replace
      cap file write `myplace' "" _n


      I have not seen this trace method before, thank you for introducing it to me.

      Comment


      • #4
        For error 1 I cannot see anything wrong with the expression preceding it.

        For error 2 there is indeed only one opening parenthesis, and there are two closing parenthesis.

        Try to reinstall -outreg2-, close your Stata, open it and try again.

        Comment


        • #5
          Thank you for the response. I've done as you suggested but unfortunately I am still receiving the same error. Is the error an underlying issue with outreg2?

          Comment


          • #6
            I think that there is an underlying issue with the very misfortunate name you have chosen for your computer. Here I am replicating the problem when using the name for your comupter:

            Code:
            . local fn `"C:\Users\Daniel's PC\ado\plus/o/outreg2.ado"'
            
            . local place=substr(`"`fn'"',1,`=length(`"`fn'"')-11')
            too few quotes
            too many ')' or ']'
            r(132);
            And here I remove the apostrophe from the name of your computer, and everything works fine:

            Code:
            . local fn `"C:\Users\Daniels PC\ado\plus/o/outreg2.ado"'
            
            . local place=substr(`"`fn'"',1,`=length(`"`fn'"')-11')

            Comment


            • #7
              Try to work from a directory which is named normally, e.g.,

              C:\Research

              and I think the problem will disappear.

              Comment

              Working...
              X