Announcement

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

  • Data Envelopment Analysis Subscript invalid

    Hello together,

    I am currently working on an efficiency study. For this I am using the data envelopment analysis (dea) package.

    With my first runs everything worked fine with simple commands like

    dea Expenses = Revenue
    But after a few runs I get with the exactly same data the following error:

    name: dealog
    log: C:\Users\chris\OneDrive\Desktop\Stata Uni\dea.log
    log type: text
    opened on: 14 Jul 2019, 17:03:28
    rankdea(): 3301 subscript invalid
    <istmt>: - function returned error
    r(3301);



    Could somebody please help me to fix this problem? I already deleted the ado and reinstalled it, still the same problem...

    Thank you very much!

    Best Regards
    Christoph

  • #2
    Posts #5 and #7 in the topic linked below give, as best we can tell, the source of the most current version of the DEA package originally released in Stata Journal as st0193, and a pointer on how to make sure you've uninstalled all previous versions before installing the latest version.

    https://www.statalist.org/forums/for...ivity-analysis

    Comment


    • #3
      I`ve tried these steps but I am getting a really similar error now with the current version:


      . dea employees = Revenue if year==2018
      (note: file C:\Users\chris\Desktop\Stata Uni\dea.log not found)
      ---------------------------------------------------------------------------------------------------------------------------------
      name: dealog
      log: C:\Users\chris\Desktop\Stata Uni\dea.log
      log type: text
      opened on: 14 Jul 2019, 18:21:13
      No Solution(XB contains missing value):[DMUi=5][LOOP=1]CRS-IN-SI-PI
      No Solution(XB contains missing value):[DMUi=17][LOOP=1]CRS-IN-SI-PI
      No Solution(XB contains missing value):[DMUi=18][LOOP=1]CRS-IN-SI-PI
      No Solution(XB contains missing value):[DMUi=19][LOOP=1]CRS-IN-SI-PI
      _dmurank(): 3301 subscript invalid
      <istmt>: - function returned error
      r(3301);


      For me it seems like something is saved in the background and makes problems. Is there a way to completly reset it?

      Comment


      • #4
        Okay, I got the solution. I had an observation in my sample that didn`t have data so stata couldn`t calculate the efficiency. I haven`t recognised this before, because with my first tries I also had them included.

        I have a little other question, I am using the following code now:
        dea employees = Revenue, saving(deaoutput)
        Everythings works fine until the program gets to the saving option. I get the error message
        invalid syntax
        . Can someone see the problem?

        Thank you!

        Comment


        • #5
          Does your output dataset already exist? The dea program has some convoluted code for making a backup of the log file if the file already exists. Past postings on Statalist suggest that the authors are not necessarily thorough about testing their code. I would add the replace option to the dea command as a start at working around the problem you are having.

          Comment


          • #6
            Sadly didn`t change the error. In my log file I only have the results and at the ending "invalid syntax". I need the results in further analysis and so it would be easier to have the results in a .dta file to automatically read them.

            Comment


            • #7
              The only solution - and this isn't the first time problems like this have been reported with dea - is to figure out what the problem is in dea.ado and correct it.

              I only have the results and at the ending "invalid syntax"
              That tells us nothing useful in finding where the problem might be in dea.ado.

              Statalist can better help you if you tell us the exact dea command you ran and everything Stata output from it, up to and including the error message.

              Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. See especially sections 9-12 on how to best pose your question. It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using code delimiters [CODE] and [/CODE] so that the results are readable, as others have done when answering your earlier posts.

              For example, the following:

              [CODE]
              . sysuse auto, clear
              (1978 Automobile Data)

              . describe make price

              storage display value
              variable name type format label variable label
              -----------------------------------------------------------------
              make str18 %-18s Make and Model
              price int %8.0gc Price
              [/CODE]

              will be presented in the post as the following:
              Code:
              . sysuse auto, clear
              (1978 Automobile Data)
              
              . describe make price
              
                            storage   display    value
              variable name   type    format     label      variable label
              -----------------------------------------------------------------
              make            str18   %-18s                 Make and Model
              price           int     %8.0gc                Price
              Last edited by William Lisowski; 14 Jul 2019, 13:14.

              Comment


              • #8
                Hello again,

                I am running the following code, for example for 2018:

                Code:
                preserve    
                    drop if employees == . | operatingexpensestotal == . | netsalesorrevenue == .
                    dea employees operatingexpensestotal = netsalesorrevenue if year == 2018, saving(output)
                restore
                The Log file has the following content:

                Code:
                ---------------------------------------------------------------------------------------------------------------------------------
                      name:  dealog
                       log:  C:\Users\chris\Desktop\Stata Uni\dea.log
                  log type:  text
                 opened on:  18 Jul 2019, 09:00:08
                
                options: RTS(CRS) ORT(IN) STAGE(2)
                CRS-INPUT Oriented DEA Efficiency Results:
                                                                       ref:          ref:          ref:          ref:          ref:          ref:
                                          rank         theta  AEROFLOT-R~_       IAG_SA_  TURK_HAVA_~_       SAS_AB_  DEUTSCHE_L~_  AIR_FRANCE~_
                dmu:AEROFLOT-R~_            21       .790455             0             0             0             0             0             0
                     dmu:IAG_SA_             5       .886869             0             0             0             0             0             0
                dmu:TURK_HAVA_~_            14       .842257             0             0             0             0             0             0
                     dmu:SAS_AB_             8       .854563             0             0             0             0             0             0
                dmu:DEUTSCHE_L~_            18       .808719             0             0             0             0             0             0
                
                [just shorted the results, they are not important and to long]
                
                invalid syntax
                r(198);
                
                end of do-file
                
                r(198);
                How ever, the "invalid syntax" stems from the saving clause in my command. It doesn`t appear, when I delete it. This doesn`t tell us really much, right? Is there a way, something like a debugg mode, to check at which line of the dea.ado it has problems?

                This is the .ado that I am running: https://sourceforge.net/projects/deas/

                Thank you!

                Best Regards
                Last edited by Christoph Hering; 18 Jul 2019, 02:46.

                Comment


                • #9
                  The output of help dea tells us that it returns the results matrix in r(dearslt). This will be a standard Stata matrix that you can access using the Stata's matrix (not Mata!) commands documented in the output of help matrix and all the help files linked from that output. For example,
                  Code:
                  matriix result = r(dearslt)
                  matrix list result, noblank nohalf noheader f(%9.6g)
                  will copy the results matrix from its temporary location and reproduce the tabular output in the log.

                  Can omitting the saving option and using the r(dearslt) matrix meet your needs? I suspect that's what other users must do for this bug to remain uncorrected.

                  Learning how to use the matrix commands will be less painful than debugging and modifying the dea code, and will have benefits in other circumstances.

                  Is there a way, something like a debugg mode, to check at which line of the dea.ado it has problems?
                  See the output of the help trace command.

                  Comment


                  • #10
                    That`s the perfect solution for me. Thank you!

                    I am using a Loop to calculate each year dea values, write them into a matrix, with svmat I add it to my dataset and save it for each year.

                    Comment

                    Working...
                    X