Announcement

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

  • outreg error

    Has anyone encountered this error with outreg?

    Code:
    . outreg using c:\tmp\regressions1.doc, merge
                    MergeL():  3499  selectindex() not found
                     Merge():     -  function returned error
                  FrmtFill():     -  function returned error
                     <istmt>:     -  function returned error
    r(3499);
    Outreg is a user-written module, installed from:
    outreg from http://fmwww.bc.edu/RePEc/bocode/o

    Code:
    . which outreg
    c:\ado\plus\o\outreg.ado
    *! Write formatted regression output to a text file
    *! version 4.31  12jul2015 by John Luke Gallup ([email protected])
    Click image for larger version

Name:	outreg.png
Views:	1
Size:	24.9 KB
ID:	1305771

  • #2
    Sergiy,

    It works fine for me on Stata 13. Notice the error is complaining Mata function selectindex() not found, which is an internal Mata function we added in Stata 13. I get the exact same error when using Stata 12. I suspect you are running version 12 or earlier.

    Hua
    Last edited by Hua Peng (StataCorp); 11 Aug 2015, 15:31.

    Comment


    • #3
      To follow Hua's comment

      Code:
       
      http://www.stata.com/help.cgi?whatsnew12to13
      documents addition of selectindex() to Stata 13. This help file should be accessible regardless of the version of Stata you are using.

      Comment


      • #4
        Dear Hua and Nick, thank you very much for your answers.
        Indeed the error was observed in version 12. However the outreg package declares compatibility with v10.1 and I recall using it with older Stata versions, so I assumed it was my problem only.

        Code:
        type http://fmwww.bc.edu/RePEc/bocode/o/outreg.pkg
        ...
        d Requires: Stata version 10.1
        ...
        Thank you very much, Sergiy Radyakin

        Comment


        • #5
          That claim is thus incorrect, or at least out-of-date. This problem has been much discussed on the forum. The only sure-fire way to test that a program runs with Stata X is to run it in Stata X.

          Comment


          • #6
            For this particular issue, there is an "easy" workaround since the missing Mata function selectindex() is fairly trivial. We can implement our own version of selectindex(v) in Stata 12. According to documentation, selectindex(v) returns

            HTML Code:
            1. a row vector of column indices j for which v[j]!=0 (v a row vector) or
            2. a column vector of row indices i for which v[i]!=0 (v a column vector)

            Code:
            *! version 1.0.0  11aug2015
            version 12.0
            
            mata:
            
            real vector selectindex(real vector v)
            {
                real scalar row, col, cnt, i
                vector res
                
                row = rows(v)
                col = cols(v)
                
                cnt = 1
                res = J(1, row*col, 0)
                for(i=1; i<=row*col; i++) {
                    if(v[i] != 0) {
                        res[cnt] = i ;
                        cnt++ ;
                    }
                }
                
                if(cnt>1) {
                    res = res[1, 1..cnt-1]
                }
                else {
                    res = J(1, 0, 0)
                }
                
                if(row>1) {
                    res = res'
                }
                
                return(res)
            }
            
            end
            We save the code to a file named select.mata. Then we create a Mata library lmyselect.mlib and add our version of selectindex() to the library


            Code:
            do select.mata
            mata: mata mlib create lmyselect
            mata: mata mlib add lmyselect selectindex()
            In order for Stata to be able to find and use the function, we need move the lmyselect.mlib to somewhere in Stata's ado path. I choose to put it under my Stata's PLUS directory c:\ado\plus\l\. Now -outreg, merge- works in Stata 12 using our version of selectindex().

            Code:
            . sysuse auto
            (1978 Automobile Data)
            
            . qui reg mpg price
            
            . outreg using test.doc
            
                                          --------------------
                                                      mpg    
                                          --------------------
                                           price    -0.001   
                                                   (4.50)**  
                                           _cons    26.964   
                                                   (19.34)**
                                           R2        0.22    
                                           N          74     
                                          --------------------
                                          * p<0.05; ** p<0.01
            
            
            . qui reg mpg price weight
            
            . outreg using test.doc, merge
            
                                    --------------------------------
                                                 mpg        mpg    
                                    --------------------------------
                                     price     -0.001     -0.000   
                                              (4.50)**    (0.57)   
                                     weight               -0.006   
                                                         (9.42)**  
                                     _cons     26.964     39.440   
                                              (19.34)**  (24.32)**
                                     R2         0.22       0.65    
                                     N           74         74     
                                    --------------------------------
                                          * p<0.05; ** p<0.01

            Comment


            • #7
              Thank you, Hua, for demonstrating how the function can be implemented in an earlier version of Stata. Yesterday, I have contacted the author of outreg John Luke Gallup off the list and he confirmed he intends to correct this issue in a future release. Best, Sergiy

              Comment


              • #8
                The outreg code should now run in Stata 10 or higher. I used Hua's suggestion to replace the selectindex() function. Several months ago I rewrote the code to merge two outreg tables to address an unusual way that users might want to merge tables, but did not notice that selectindex() is a post-Stata 10 function. Thanks for tracking down the problem and suggesting a solution. The corrected version is outreg 4.32.

                Comment


                • #9
                  I have a similar problem with outreg (Stata 16.1 5/1/2021; outreg 4.32):

                  Code:
                  . outreg
                                MakeSmat():  3499  _CColJoin() not found
                               CalcStats():     -  function returned error
                                   <istmt>:     -  function returned error
                  r(3499);

                  Comment


                  • #10
                    The program author John Gallup is a member here but posts intermittently. If you don't get a quick answer from him, or anybody else, I would advise using direct email.

                    Richard knows this but to prevent confusion it may help others to know that outreg is now not at all the same as outreg2.

                    Comment


                    • #11
                      What can I do if I have Stata 11 to fix the same problem?

                      Comment


                      • #12
                        The same problem as that in which post?

                        outreg on SSC states that it should work in Stata 10.1 (upwards). So, what error do you get?

                        Comment


                        • #13
                          I am using Stata 11.
                          I am testing the ppmlhdfe comand but I have this error:

                          GLM::init_variables(): - function returned error
                          <istmt>: - function returned error
                          r(3499);

                          Comment


                          • #14
                            On the face of it, that error is nothing to with outreg and in any case is hard to diagnose without any other details. Please read the FAQ Advice and start a new thread mentioning ppmlhdfe in the title.

                            Comment


                            • #15
                              You did that earlier -- https://www.statalist.org/forums/for...ppmlhdfe-error -- but you'd increase your chance of a good answer by adding there some details of what you tried by way of code.

                              Comment

                              Working...
                              X