Announcement

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

  • eventstudy2 --> variable __00002G not found --> r(111);

    I am running the command "eventstudy2" but I am getting the rror message

    variable __00002G not found
    r(111);

    I am also attaching the image. Is there any way to solve it?

    Thank you!










    Attached Files

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. We generally don't like images - no way we could possibly replicate your problem from these images.

    With such internal problems with user written routines, you have relatively few options. First, update all to make sure you have the current version. I'd next make sure it runs properly for some very simple data. I'd also make sure I don't have missing data (while Stata generally handles missing data well, that might not be the case for this procedure). You can open up the ado file (every such procedure you run has an ado file on your computer) and see if you can diagnose it yourself. Just adding a bunch of lists or summary statements or whatever might help you figure out the problem. Or you can contact the authors.

    Comment


    • #3
      Hallo Phil,

      Thank you very much for your answer. Please find code and sample data attached. Please note that as it seems I could not upload the *.dta files so I am uploading the equivalent *.xlsx files.
      Attached Files

      Comment


      • #4

        cd "F:\Thesis\STATA commands\eventstudy2\eventstudy2_example002"

        pwd

        import excel "marketfile.xlsx", sheet("Sheet1") firstrow clear
        destring, replace
        //drop if date ==.
        save "marketfile.dta", replace
        use "marketfile.dta", clear

        describe

        import excel "security_returns_file.xlsx", sheet("Sheet1") firstrow clear
        destring, replace
        //drop if date ==.
        save "security_returns_file.dta", replace
        use "security_returns_file.dta", clear

        describe

        import excel "eventfile.xlsx", sheet("Sheet1") firstrow clear
        destring, replace
        //drop if date ==.
        save "eventfile.dta", replace
        use "eventfile.dta", clear

        describe

        //destring, replace
        //xtset security_id_numerical date
        //tsset date security_id_numerical

        //pwd
        //use eventfile, clear

        eventstudy2 security_id date using security_returns_file, evwlb(-1) evwub(1) eswlb(-10) returns(simple_return) model(MA) marketfile(marketfile) mar(market) idmar(marketref) risk(rf)


        // ################################################## ###########################



        Comment


        • #5
          OUTPUT
          ************************************************** ********************
          ************************************************** ********************



          . do "F:\Thesis\STATA commands\eventstudy2\eventstudy2_example002\Thesis Stata_EVENTSTUDY2_001.
          > do"

          .
          . cd "F:\Thesis\STATA commands\eventstudy2\eventstudy2_example002"
          F:\Thesis\STATA commands\eventstudy2\eventstudy2_example002

          .
          . pwd
          F:\Thesis\STATA commands\eventstudy2\eventstudy2_example002

          .
          . import excel "marketfile.xlsx", sheet("Sheet1") firstrow clear

          . destring, replace
          date already numeric; no replace
          marketref already numeric; no replace
          market already numeric; no replace
          smb already numeric; no replace
          hml already numeric; no replace
          rf already numeric; no replace

          . //drop if date ==.
          . save "marketfile.dta", replace
          file marketfile.dta saved

          . use "marketfile.dta", clear

          .
          . describe

          Contains data from marketfile.dta
          obs: 815
          vars: 6 2 Nov 2018 18:19
          size: 28,525
          ----------------------------------------------------------------------------------------------
          storage display value
          variable name type format label variable label
          ----------------------------------------------------------------------------------------------
          date int %td.. date
          marketref byte %10.0g marketref
          market double %10.0g market
          smb double %10.0g smb
          hml double %10.0g hml
          rf double %10.0g rf
          ----------------------------------------------------------------------------------------------
          Sorted by:

          .
          . import excel "security_returns_file.xlsx", sheet("Sheet1") firstrow clear

          . destring, replace
          security_id contains nonnumeric characters; no replace
          open already numeric; no replace
          high already numeric; no replace
          low already numeric; no replace
          close already numeric; no replace
          date already numeric; no replace
          simple_return already numeric; no replace
          log_return already numeric; no replace
          marketref already numeric; no replace

          . //drop if date ==.
          . save "security_returns_file.dta", replace
          file security_returns_file.dta saved

          . use "security_returns_file.dta", clear

          .
          . describe

          Contains data from security_returns_file.dta
          obs: 607
          vars: 9 2 Nov 2018 18:19
          size: 32,778
          ----------------------------------------------------------------------------------------------
          storage display value
          variable name type format label variable label
          ----------------------------------------------------------------------------------------------
          security_id str3 %9s security_id
          open double %14.2f open
          high double %14.2f high
          low double %14.2f low
          close double %14.2f close
          date int %td.. date
          simple_return double %14.2f simple_return
          log_return double %14.2f log_return
          marketref byte %10.0g marketref
          ----------------------------------------------------------------------------------------------
          Sorted by:

          .
          . import excel "eventfile.xlsx", sheet("Sheet1") firstrow clear

          . destring, replace
          date already numeric; no replace
          security_id contains nonnumeric characters; no replace
          marketref already numeric; no replace
          id contains nonnumeric characters; no replace

          . //drop if date ==.
          . save "eventfile.dta", replace
          file eventfile.dta saved

          . use "eventfile.dta", clear

          .
          . describe

          Contains data from eventfile.dta
          obs: 1
          vars: 4 2 Nov 2018 18:19
          size: 9
          ----------------------------------------------------------------------------------------------
          storage display value
          variable name type format label variable label
          ----------------------------------------------------------------------------------------------
          date int %td.. date
          security_id str3 %9s security_id
          marketref byte %10.0g marketref
          id str3 %9s id
          ----------------------------------------------------------------------------------------------
          Sorted by:

          .
          . //destring, replace
          . //xtset security_id_numerical date
          . //tsset date security_id_numerical
          .
          . //pwd
          . //use eventfile, clear
          .
          . eventstudy2 security_id date using security_returns_file, evwlb(-1) evwub(1) eswlb(-10) retu
          > rns(simple_return) model(MA) marketfile(marketfile) mar(market) idmar(marketref) risk(rf)
          Generating dateline ...
          ...succeeded
          Preparation of event list ...
          ...succeeded
          Preparation of security return data...
          ...succeeded
          Preparation of market and/or factor return data...
          ...succeeded
          Merging event dates and stock market data...
          ...succeeded
          Calculating abnormal returns...
          variable __00002G not found
          r(111);

          end of do-file

          r(111);

          .

          Comment


          • #6
            Hello,

            I would like to know if this issue was resolved. I am having Similar error. Variable _00002F not found r(111)

            Comment


            • #7
              Hi!

              One of my student groups came across this issue , so i had to dig into possible reasons for it and that is how i came to this post.
              In my case, the reason for this was that there weren't 20 days with return data after the event day. Eventstudy2 uses as a default -20;+20 as a maximum event window, so adjustments to the command need to be made if one needs longer or shorter window (and for shorter window, the real issue comes if there is not enough data to cover the period). inserting evwlb(-N) evwub(N) solved it for me, because they only had 5 days of data after the event (bad idea, but that is another discussion) so, upper bound had to be 5. I see above though that you included evwlb(-1) evwub(1), which constraints the possible CAR calculations to this interval; so it doesn't seem to be the same situation as mine , because i did not use evw option in the beginning. But maybe worth trying to increase the interval for evwlb(-1) evwub(1) , and then add the CARLB and CARUB for example, to fit that interval. I am not entirely sure what the command does if no interval is specified for the CAR or BHAR calculation.


              Comment

              Working...
              X