Announcement

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

  • Error on outreg2

    My code is below, whenever I try and execute it, it gives me an error that says,
    "command outreg2 is unrecognized
    r(199)".

    Any help would be appreciated.

    "forval i=1/12 {

    if strpos("`variationname`i''", "Non") == 0 {
    reg `variation`i'' if (time>52 & time <323),
    if `i'==1 outreg2 using "`filename'",replace dta stats(coef se pval) noaster auto(8) adjr2 ctitle(variation`i' `variationname`i'')
    else outreg2 using "`filename'",append dta stats(coef se pval) noaster auto(8) adjr2 ctitle(variation`i' `variationname`i'')
    quietly newey `variation`i'' if (time>52 & time <323), lag(5)
    outreg2 using "`filename'",append dta stats(coef se pval) noaster auto(8) ctitle(Newey variation`i' `variationname`i'')
    }
    else {
    quietly reg `variation`i'' if (time>209 & time <323),
    outreg2 using "`filename'",append dta stats(coef se pval) noaster auto(8) adjr2 ctitle(variation`i' `variationname`i'')
    newey `variation`i'' if (time>209 & time <323), lag(4)
    outreg2 using "`filename'",append dta stats(coef se pval) noaster auto(8) ctitle(Newey variation`i' `variationname`i'')
    }

    predict projvariation`i'
    if strpos("`variationname`i''", "Price") == 0 replace projvariation`i' = projvariation`i' * (1000000)
    if strpos("`variationname`i''", "Non") == 0 replace projvariation`i' = . in 1/52
    else replace projvariation`i' = . in 1/209
    }

  • #2
    outreg2 (SSC) is user-written and must be installed before you can use it.

    Code:
    ssc inst outreg2

    Comment


    • #3
      Hey Nick Cox
      thanks for your help, worked well. But then I got an other error. I am using a mac OS Monterey 12.3.1 and got this error. Do you have any idea how to fix it?



      . outreg2 using testimport.doc, ctitle(full sample) replace dec(2) label addtext (Controls, No, Cluster SE, No)
      file testimport.txt could not be opened
      r(603);

      Comment


      • #4
        I don't know much more about outreg2 than I posted in 2016 in #2.

        So all I can say is

        1. The error message doesn't (seem to) refer to the file you name in your command.

        2. Problems could start with the file already being open or your not having write permission in that place (although that is a problem sometimes under Windows and may not apply to Macs).

        outreg2 is a popular download but its author long since has left Statalist. There seem to be many users here but fewer experts. I have no idea whether the author continues to provide support through email but you could try.

        Cross-posted at https://www.reddit.com/r/stata/comme..._not_be_opened
        Last edited by Nick Cox; 30 Nov 2022, 19:15.

        Comment

        Working...
        X