Announcement

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

  • Create a control group matching categorical and continuous variables

    Dear all, I would like to analyze whether a change in CFO has a significant impact on Discretionary Accruals of a company. I am a bit stuck when it comes to creating the control group for the 135 observations where a CFO change has taken place.

    The data set contains following relevant variables:
    • Company
    • year
    • Industry
    • acd (a Dummy indicating the accounting standard)
    • ROAt (Return on assets)
    • Group (a Dummy indicating whether the company is affected by a change of CFO or not)
    • DA (discretionary accruals)
    I need to create a control group with the same number of observations as the "treated" group (the observations which where the CFO has changed), in order to then see if the variable DA is significantly different if the company is affected by a CFO change (using the ttest and Wilcoxon Sign-Rank test).

    So for each of the 135 observations where Group == 1 I need to find one matching observation, which has the same Industry, the same Accounting Standard (acd) and the closest ROA (if necessary including a range of acceptable deviation,e.g. 5%). The reason why I only want one matching observation is because that is how it was done in the paper I am leaning on.
    I am not sure how to proceed, I tried teffects nnmatch but even if it were the right way to go, I wasn't able to include any criteria in the command in order to have the closest ROAt matched. I would really appreciate any help or guidance I can get.


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str29 Company str18 Ind int yr byte(acd Group) long(comp ind acc) float DA long(ROAt ROAt1)
    "CHAM PAPER GROUP HOLDING" "Basic Materials" 2006 1 0  46 1 1    -.0110244   35   34
    "CPH CHEMIE+PAPIER HLDG."  "Basic Materials" 2006 0 0  56 1 2  -.008352783  716  724
    "GIVAUDAN 'N'"             "Basic Materials" 2006 1 1  77 1 1    .04223541  982  977
    "EMS-CHEMIE 'N'"           "Basic Materials" 2006 1 0  67 1 1   .013005187 1158 1114
    "SCHMOLZ+BICKENBACH"       "Basic Materials" 2006 0 0 149 1 2    .02414643  820 1151
    "CLARIANT"                 "Basic Materials" 2007 1 1  51 1 1   -.05833853  317  311
    "GIVAUDAN 'N'"             "Basic Materials" 2007 1 0  77 1 1  -.009050042  308  358
    "CPH CHEMIE+PAPIER HLDG."  "Basic Materials" 2007 0 0  56 1 2  -.003814873  601  627
    "SCHMOLZ+BICKENBACH"       "Basic Materials" 2007 0 0 149 1 2 -.0010533907  872  956
    "EMS-CHEMIE 'N'"           "Basic Materials" 2007 1 0  67 1 1   .012165825 1145 1099
    "CLARIANT"                 "Basic Materials" 2008 1 0  51 1 1  -.010936338   12   11
    "GIVAUDAN 'N'"             "Basic Materials" 2008 1 0  77 1 1   -.02204232  331  313
    "SCHMOLZ+BICKENBACH"       "Basic Materials" 2008 0 0 149 1 2    .04708272  383  374
    "CPH CHEMIE+PAPIER HLDG."  "Basic Materials" 2008 0 0  56 1 2  -.006268527  454  434
    "GURIT HOLDING"            "Basic Materials" 2008 1 1  82 1 1   -.02049125  609  468
    "EMS-CHEMIE 'N'"           "Basic Materials" 2008 1 0  67 1 1  -.004758666 1151  967
    "SYNGENTA"                 "Basic Materials" 2008 1 1 171 1 1  -.019291876 1048 1032
    "ZWAHLEN &.MAYR"           "Basic Materials" 2009 1 1 204 1 1   -.01324626   10    6
    "CLARIANT"                 "Basic Materials" 2009 1 0  51 1 1  -.018284952   52   55
    "SCHMOLZ+BICKENBACH"       "Basic Materials" 2009 1 0 149 1 1   -.00679974  118  107
    end
    label values comp comp
    label def comp 46 "CHAM PAPER GROUP HOLDING", modify
    label def comp 51 "CLARIANT", modify
    label def comp 56 "CPH CHEMIE+PAPIER HLDG.", modify
    label def comp 67 "EMS-CHEMIE 'N'", modify
    label def comp 77 "GIVAUDAN 'N'", modify
    label def comp 82 "GURIT HOLDING", modify
    label def comp 149 "SCHMOLZ+BICKENBACH", modify
    label def comp 171 "SYNGENTA", modify
    label def comp 204 "ZWAHLEN &.MAYR", modify
    label values ind ind
    label def ind 1 "Basic Materials", modify
    label values acc acc
    label def acc 1 "IFRS", modify
    label def acc 2 "Local standards", modify
    label values ROAt roat
    label def roat 10 "-.0050583805575628", modify
    label def roat 12 "-.006123490389522", modify
    label def roat 35 "-.0197317947810028", modify
    label def roat 52 "-.0342363303972079", modify
    label def roat 118 "-.135820992766688", modify
    label def roat 308 ".0122046221760582", modify
    label def roat 317 ".0140825432236475", modify
    label def roat 331 ".0160311958405546", modify
    label def roat 383 ".0250358028616852", modify
    label def roat 454 ".0328532833955408", modify
    label def roat 601 ".0457198084740636", modify
    label def roat 609 ".0462843234197916", modify
    label def roat 716 ".0562583169364103", modify
    label def roat 820 ".0689808159968209", modify
    label def roat 872 ".0750474588442061", modify
    label def roat 982 ".090708938793483", modify
    label def roat 1048 ".100293679848734", modify
    label def roat 1145 ".125111440520236", modify
    label def roat 1151 ".126749741028453", modify
    label def roat 1158 ".127947792107905", modify
    label values ROAt1 roat1
    label def roat1 6 "-.0038232123607618", modify
    label def roat1 11 "-.0050195203569437", modify
    label def roat1 34 "-.0193693048995754", modify
    label def roat1 55 "-.0350399727844872", modify
    label def roat1 107 "-.110296216216216", modify
    label def roat1 311 ".014227355965629", modify
    label def roat1 313 ".0144118410802389", modify
    label def roat1 358 ".0206957287538529", modify
    label def roat1 374 ".0244043592708893", modify
    label def roat1 434 ".0322470149167212", modify
    label def roat1 468 ".0354003262032641", modify
    label def roat1 627 ".0493374884842419", modify
    label def roat1 724 ".0602307970498307", modify
    label def roat1 956 ".0915344873837046", modify
    label def roat1 967 ".0935252560979325", modify
    label def roat1 977 ".0944737445540014", modify
    label def roat1 1032 ".104716146994643", modify
    label def roat1 1099 ".121879928042513", modify
    label def roat1 1114 ".126581896006921", modify
    label def roat1 1151 ".137851444457875", modify

  • #2
    Your question is ill-posed and you need to either rethink this or explore in greater depth how it was done in the paper you are leaning on.

    The major problem is that both acd and ROA are time-varying within firms. The firm that is the best match for a given case in one year may (usually will) be different from the best match for the same case in another year. So you need to decide how to deal with that. One possibility is to pick a "base" year and do the matching based on the values in that year only. Another possibility is that you allow the same case company to match with different controls in different years, but this is a rather odd matching structure and I'm not sure that any matched-pair based testing done on this will produce reliable results. At best, the within-pair variation will be sufficiently large that you are more or less defeating the whole purpose of matching by doing this. Another approach is to consider only matches that meet the criteria in every year, but that is a very stringent criterion and you may end up with a large number of cases that have no suitable matched control.

    You also have a really serious problem in your data with the variables ROAt and ROAt1. Whoever created the data set set them up as integer variables with value labels attached. I'm guessing that this data originated in a spreadsheet, and because of some garbage in some cells for those variables, they ended up being brought into Stata as a string. Then the variables were erroneously converted to numeric storage using -encode- when -destring- is what should have been used. The variables in their current incarnation as value-labeled integers are completely useless for computational purposes. The best you can rely on them for as they stand is that the rank order of the integer values seems to correspond to the rank order of the labels, so these variables will each sort correctly. But you can't compare them correctly to each other, and you certainly can't do any calculations with them. Just for fun, try -summ ROAt- and see what nonsense you get. You need to get that fixed before you do anything else with these variables.
    Last edited by Clyde Schechter; 14 Sep 2017, 16:08.

    Comment


    • #3
      Dear Mr. Schechter,

      Thank you very much for your comments and the hint about ROAt and ROAt1 - I don't know when I would have figured it out myself.

      I have given it some thought and I am wondering if it would change things if we disregard the company and the year. Say, the only thing that matters, is, if DA is significantly different for the observations affected by a CFO change compared to those that aren't (Group=1 or Group=0)? So we try to create a control group for the observations where Group = 1, matching on industry, accounting standard and the closest ROA but disregarding the fact that those observations are companies in different years? Still only matching one control observation to one test observation.

      The way it is described in the paper is as follows. I even managed to get in touch with one of the authors but he didn't remember how exactly they had done the control group matching at the time.
      Our test group comprises all firm years directly subsequent to CFO turnover (t + 1). For the control group, we consider each firm year that is unaffected by CFO turnover. [...] Drawing on Kothari et al. (2005) [...], we match each firm year from the test group to the control group firm year that has the most similar return on assets (ROA) under the same accounting standards and in the same industry.

      Comment


      • #4
        Well, the description you quote sounds to me like doing the one-one matching in a way that allows a case firm to be matched with different control firms in different years. The excerpt you quote does not describe additional analysis. Doing a ttest or a sign rank test on matched pairs formed in this way also does, in effect, ignore the firm-year panel structure of the data. To my mine this is an invalid way to approach this data, at least without an explicit demonstration that in this data, the firm-year panel structure actually makes no difference. But I haven't read the whole article, and I suppose your task at hand is simply to replicate this particular paper's methodology, so, having offered my opinion, we can move on.
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input str29 Company str18 Ind int yr byte(acd Group) long(comp ind acc) float DA double(roat roat1)
        "CHAM PAPER GROUP HOLDING" "Basic Materials" 2006 1 0  46 1 1    -.0110244 -.0197317947810028 -.0193693048995754
        "CPH CHEMIE+PAPIER HLDG."  "Basic Materials" 2006 0 0  56 1 2  -.008352783  .0562583169364103  .0602307970498307
        "GIVAUDAN 'N'"             "Basic Materials" 2006 1 1  77 1 1    .04223541   .090708938793483  .0944737445540014
        "EMS-CHEMIE 'N'"           "Basic Materials" 2006 1 0  67 1 1   .013005187   .127947792107905   .126581896006921
        "SCHMOLZ+BICKENBACH"       "Basic Materials" 2006 0 0 149 1 2    .02414643  .0689808159968209   .137851444457875
        "CLARIANT"                 "Basic Materials" 2007 1 1  51 1 1   -.05833853  .0140825432236475   .014227355965629
        "GIVAUDAN 'N'"             "Basic Materials" 2007 1 0  77 1 1  -.009050042  .0122046221760582  .0206957287538529
        "CPH CHEMIE+PAPIER HLDG."  "Basic Materials" 2007 0 0  56 1 2  -.003814873  .0457198084740636  .0493374884842419
        "SCHMOLZ+BICKENBACH"       "Basic Materials" 2007 0 0 149 1 2 -.0010533907  .0750474588442061  .0915344873837046
        "EMS-CHEMIE 'N'"           "Basic Materials" 2007 1 0  67 1 1   .012165825   .125111440520236   .121879928042513
        "CLARIANT"                 "Basic Materials" 2008 1 0  51 1 1  -.010936338  -.006123490389522 -.0050195203569437
        "GIVAUDAN 'N'"             "Basic Materials" 2008 1 0  77 1 1   -.02204232  .0160311958405546  .0144118410802389
        "SCHMOLZ+BICKENBACH"       "Basic Materials" 2008 0 0 149 1 2    .04708272  .0250358028616852  .0244043592708893
        "CPH CHEMIE+PAPIER HLDG."  "Basic Materials" 2008 0 0  56 1 2  -.006268527  .0328532833955408  .0322470149167212
        "GURIT HOLDING"            "Basic Materials" 2008 1 1  82 1 1   -.02049125  .0462843234197916  .0354003262032641
        "EMS-CHEMIE 'N'"           "Basic Materials" 2008 1 0  67 1 1  -.004758666   .126749741028453  .0935252560979325
        "SYNGENTA"                 "Basic Materials" 2008 1 1 171 1 1  -.019291876   .100293679848734   .104716146994643
        "ZWAHLEN &.MAYR"           "Basic Materials" 2009 1 1 204 1 1   -.01324626 -.0050583805575628 -.0038232123607618
        "CLARIANT"                 "Basic Materials" 2009 1 0  51 1 1  -.018284952 -.0342363303972079 -.0350399727844872
        "SCHMOLZ+BICKENBACH"       "Basic Materials" 2009 1 0 149 1 1   -.00679974  -.135820992766688  -.110296216216216
        end
        label values comp comp
        label def comp 46 "CHAM PAPER GROUP HOLDING", modify
        label def comp 51 "CLARIANT", modify
        label def comp 56 "CPH CHEMIE+PAPIER HLDG.", modify
        label def comp 67 "EMS-CHEMIE 'N'", modify
        label def comp 77 "GIVAUDAN 'N'", modify
        label def comp 82 "GURIT HOLDING", modify
        label def comp 149 "SCHMOLZ+BICKENBACH", modify
        label def comp 171 "SYNGENTA", modify
        label def comp 204 "ZWAHLEN &.MAYR", modify
        label values ind ind
        label def ind 1 "Basic Materials", modify
        label values acc acc
        label def acc 1 "IFRS", modify
        label def acc 2 "Local standards", modify
        
        //    CREATE A FILE OF JUST CONTROLS
        //    AND RENAME THE VARIABLES
        preserve
        keep if Group == 0
        ds acd, not
        rename (`r(varlist)') =_ctrl
        tempfile controls
        save `controls'
        
        //    BRING BACK THE DATA & KEEP ONLY CASES
        restore
        keep if Group == 1
        //    UNIQUELY IDENTIFY EACH OBSERVATION
        gen long obs_no = _n
        
        //    MATCH EXACTLY ON acd
        joinby acd using `controls'
        drop if missing(Company_ctrl)    // NO MATCHES AVAILABLE
        
        //    RETAIN THE BEST MATCH ON roat
        gen delta = abs(roat-roat_ctrl)
        set seed 1234 // OR YOUR FAVORITE SEED NUMBER
        gen double shuffle1 = runiform()
        gen double shuffle2 = runiform()
        by obs_no (delta shuffle1 shuffle2), sort: keep if _n == 1
        
        //    DO MATCHED-PAIRS CONTRAST OF DA
        ttest DA = DA_ctrl
        signrank DA = DA_ctrl
        Notes:
        1. The data I am using here has roat and roat1 cleaned up. You will need to do that in your own data as well.
        2. The random numbers used in the matching procedure are how we break ties (if there are any) randomly, but reproducibly.

        Comment


        • #5
          Dear Mr. Schechter,

          Once again, thank you very much for your help. Regarding the further analysis - yes I only quoted the relevant excerpt for this part of the analysis; however, in a second step, a multivariate analysis will be done, and the final interpretation of the data will be based on both analyses. At least the panel structure is accounted for in that second step, but you are right, I am basically just replicating that particular methodology.

          I have one follow up question on the code. As far as I understand it, your code just matches on the accounting standard (acd). Is it correct, to simply adapt the following lines of the code in order to match by accounting standard (acd) and industry?

          Code:
          encode Ind, g(ind)
          
          ds acd, not
          *replaced by
          ds acd ind, not
          
          joinby acd using `controls'
          *replaced by
          joinby acd ind using `controls'
          The outcome seems to look fine, I generated an additional Industry variable, which is then renamed to Industry_ctrl in order to check if there is the same amount of observations per industry in ind and Industry_ctrl, which is the case. However, I would like to be sure that it is correct and doesn't just appear to be correct.

          Comment


          • #6
            Yes, that is the correct way to modify the code to get matches on both acd and ind.

            Comment


            • #7
              Dear all,

              I'm using the code Clyde Schechter provided above, with which there is no problem:
              Code:
              preserve
              keep if sample == 0
              ds ff17 year_account, not
              rename (`r(varlist)') =_ctrl
              tempfile controls
              save `controls'
              restore
              keep if sample == 1
              gen long obs_no = _n
              joinby ff17 year_account using `controls'
              drop if missing(Company_ctrl)
              gen delta = abs(roa-roa_ctrl)
              set seed 1234
              gen double shuffle1 = runiform()
              gen double shuffle2 = runiform()
              by obs_no (delta shuffle1 shuffle2), sort: keep if _n == 1
              What I would like to know is if there is a way to save the
              tempfile controls
              as a .dta file since, as it is, i'm getting the following error message (which I think/hope would be solvde doing a -joinby- without data in memory):


              . joinby ff17 year_account using `controls'
              op. sys. refuses to provide memory
              r(909);

              end of do-file

              r(909);
              My PC has Windows 10 and 8GB RAM.
              Best Regards,

              Pedro
              (StataMP 16 user)

              Comment


              • #8
                You can save the controls file as a regular file in the usual way. Just skip the -tempfile- command, pick a name for the file and then save it under that name. For example, if you want to call it controls.dta, the code becomes

                Code:
                preserve
                keep if sample == 0
                ds ff17 year_account, not
                rename (`r(varlist)') =_ctrl
                save controls, replace
                restore
                keep if sample == 1
                gen long obs_no = _n
                joinby ff17 year_account using controls
                drop if missing(Company_ctrl)
                gen delta = abs(roa-roa_ctrl)
                set seed 1234
                gen double shuffle1 = runiform()
                gen double shuffle2 = runiform()
                by obs_no (delta shuffle1 shuffle2), sort: keep if _n == 1
                That said, it would surprise me greatly if that solves your "op. sys. refuses to provide memory" problem. I suppose it's worth a try. But if, as I expect, you still are short of memory, post back and I can give you some other suggestions.

                Comment


                • #9
                  Dear Clyde,

                  First of all, thank you very much.

                  As usual, you are absolutely right: it gives the same
                  "op. sys. refuses to provide memory" problem. It was just a "blind guess". So, I would greatly apreciate any suggestions you may give.

                  Could you also confirm if the way I adapted your code ensures me to get a match is between firms in the same year_account and same ff17 (industry identification)? I don't need to match a firm in the sample group with always the same in the control group - it can (and probably will) change from one accounting year (year_account) to another.
                  Best Regards,

                  Pedro
                  (StataMP 16 user)

                  Comment


                  • #10
                    Yes, the problem is that -joinby- wants to start out pairing up every observation for a given ff17 and year_account with all other observations with the same ff17 and year_account. When you add that up over your entire data set, the result is too massive for your available memory, even though the end result after excess observations are removed, is at most twice the size of the data set you start with. The trick to working around this is that this pairing process never needs to look at observations with different ff17s at the same time. So we can start out by breaking the original data set up into pieces, one ff17 per piece, save those each on disk (where memory is, relatively speaking, unlimited) and then do the matching on each piece separately, and appending the results together. The -runby- command does this in a relatively memory-sparing way and is also much faster than doing it with looping, so we use that to drive the process.

                    Code:
                    //  SAVE EACG FF17'S OBSERVATIONS AS A SEPARATE 
                    //  DATA FILE ON DISK
                    capture program drop split_one_ff17
                    program define split_one_ff17
                        local ff17 = strtoname(ff17[1], 1) // CREATE A FILENAME FOR THIS FF17's DATA
                        save `"`ff17'.dta"', replace
                        exit
                    end
                    runby slipt_one_ff17, by(ff17) status
                    
                    //  NOW DO THE PAIRING SEPARATELY ON EACH FF17
                    capture program drop match_one_ff17
                    program define match_one_ff17
                        preserve
                        local ff17 = strtoname(ff17[1], 1) 
                        keep if sample == 0
                        ds ff17 year_account, not
                        rename (`r(varlist)') =_ctrl
                        tempfile controls
                        save `"`controls'"', replace
                        restore
                        keep if sample == 1
                        gen long obs_no = _n
                        joinby ff17 year_account using `""'`ff17'"'
                        drop if missing(Company_ctrl)
                        gen delta = abs(roa-roa_ctrl)
                        gen double shuffle1 = runiform()
                        gen double shuffle2 = runiform()
                        by obs_no (delta shuffle1 shuffle2), sort: keep if _n == 1
                        erase `"`ff17'.dta"'
                        exit
                    end
                    set seed 1234
                    runby match_one_ff17, by(ff17) status
                    Notes:

                    This code assumes that ff17 is a string variable. If it is not, change the -local ff17 = strtoname(ff17[1], 1)- lines to -local ff17 = strtoname(string(ff17[1], 1)- in both programs.

                    -runby- is written by Robert Picard and me and is available from SSC.

                    At the end of this process the data set in memory will contain the matched pairs. And yes, your modifications of the code will assure that each matched pair has the same ff17 and year_account in the case and in the control.

                    The line -erase `"`ff17'"' will erase each of those newly created one-ff17 files as they are processed so that in the end your disk will not be cluttered up with them.

                    Finally, this is not tested, so beware of typos or other glitches.

                    Comment


                    • #11
                      Thanks again Clyde.

                      I got the following message:
                      Code:
                      .
                      . capture program drop split_one_ff17
                      
                      . program define split_one_ff17
                        1.     local local ff17 = strtoname(string(ff17[1], 1)
                        2.     save `"`ff17'.dta"', replace
                        3.     exit
                        4. end
                      
                      . runby slipt_one_ff17, by(ff17) status
                      
                        elapsed ----------- by-groups ----------    ------- observations ------       time
                           time      count     errors    no-data        processed         saved  remaining
                      ------------------------------------------------------------------------------------
                       00:00:00         18         18          0          227,830             0   00:00:00
                      
                      --------------------------------------
                      Number of by-groups    =            18
                      by-groups with errors  =            18
                      by-groups with no data =             0
                      Observations processed =       227,830
                      Observations saved     =             0
                      --------------------------------------
                      
                      .
                      . capture program drop match_one_ff17
                      
                      . program define match_one_ff17
                        1.     preserve
                        2.     local local ff17 = strtoname(string(ff17[1], 1)
                        3.     keep if sample == 0
                        4.     ds ff17 year_account, not
                        5.     rename (`r(varlist)') =_ctrl
                        6.     tempfile controls
                        7.     save `"`controls'"', replace
                        8.     restore
                        9.     keep if sample == 1
                       10.     gen long obs_no = _n
                       11.     joinby ff17 year_account using `""'`ff17'"'
                       12.     drop if missing(newid_ctrl)
                       13.     gen delta = abs(roa-roa_ctrl)
                       14.     gen double shuffle1 = runiform()
                       15.     gen double shuffle2 = runiform()
                       16.     by obs_no (delta shuffle1 shuffle2), sort: keep if _n == 1
                       17.     erase `"`ff17'.dta"'
                       18.     exit
                       19. end
                      
                      . set seed 1234
                      
                      . runby match_one_ff17, by(ff17) status
                      no variables defined
                      (error in option by())
                      r(111);
                      
                      end of do-file
                      
                      r(111);
                      ff17 is, in fact, a numerical variable, so I did the change you pointed out.

                      Here's a sample of the relevant variables from my dataset:
                      Code:
                      * Example generated by -dataex-. To install: ssc install dataex
                      clear
                      input int year_account float(newid sample roa)
                      1999 1 1    .05297323
                      2000 1 1    .04722103
                      2001 1 1    .04962205
                      2002 1 1    .04129402
                      2003 1 1    .01147783
                      2004 1 1   .034888357
                      2005 1 1    .04821287
                      2006 1 1    .04752731
                      2007 1 1    .04293722
                      2008 1 1    .01614414
                      2009 1 1   .015847994
                      2010 1 1   .007870924
                      2011 1 1    .01865518
                      2012 1 1   .019783974
                      2013 1 1   .014261578
                      2014 1 1   .021104293
                      2015 1 1   .002816258
                      2016 1 1   .023566334
                      2017 1 1    .02301912
                      2018 1 1 -.0040208194
                      1999 2 1    -14.82731
                      2000 2 1     -.358747
                      2001 2 1    .13859312
                      2002 2 1   -.55655575
                      2003 2 1    -.5580719
                      2004 2 1    -.0845492
                      2005 2 1    -.9915283
                      2006 2 1    -1.237344
                      2007 2 1   -1.2936544
                      2008 2 1    -.3779378
                      2009 2 1    .12664233
                      2010 2 1            .
                      2011 2 1            .
                      2012 2 1            .
                      2013 2 1            .
                      2014 2 1            .
                      2015 2 1            .
                      2016 2 1            .
                      2017 2 1            .
                      2018 2 1            .
                      1999 3 1    .07218115
                      2000 3 1    .06083666
                      2001 3 1    .04736265
                      2002 3 1    .04330914
                      2003 3 1    .04338196
                      2004 3 1    .05440877
                      2005 3 1    .08034838
                      2006 3 1    .09727177
                      2007 3 1     .0978115
                      2008 3 1    .05462816
                      2009 3 1   .026058545
                      2010 3 1     .0312283
                      2011 3 1    .02596144
                      2012 3 1   .026566265
                      2013 3 1   .037064556
                      2014 3 1    .02075909
                      2015 3 1    .04130294
                      2016 3 1    .05802171
                      2017 3 1    .05039894
                      2018 3 1    .04912275
                      1999 4 1   -.14504588
                      2000 4 1   -.29004258
                      2001 4 1     -.478722
                      2002 4 1   -.05216377
                      2003 4 1   .014631253
                      2004 4 1   -.08067302
                      2005 4 1   .020376414
                      2006 4 1    .05344269
                      2007 4 1    .07122867
                      2008 4 1    -.3285307
                      2009 4 1            .
                      2010 4 1            .
                      2011 4 1            .
                      2012 4 1            .
                      2013 4 1            .
                      2014 4 1            .
                      2015 4 1            .
                      2016 4 1            .
                      2017 4 1            .
                      2018 4 1            .
                      1999 5 0    .03010797
                      2000 5 0   .036159616
                      2001 5 0    .02844329
                      2002 5 0   .029099787
                      2003 5 0    .02717819
                      2004 5 0     .0811325
                      2005 5 0    .11299005
                      2006 5 0    .08987702
                      2007 5 0    .08382182
                      2008 5 0    .07272602
                      2009 5 0     .1387264
                      2010 5 0    .09205497
                      2011 5 0     .1074222
                      2012 5 0    .08923771
                      2013 5 0    .10090785
                      2014 5 0    .04049423
                      2015 5 0    .01990503
                      2016 5 0     .0789244
                      2017 5 0    .05071925
                      2018 5 0    .03675954
                      end
                      format %ty year_account
                      Where newid identifies the firm, sample indicates if it is a sample firm or a control firm and year_account is the year to which accounting data refers to.
                      Best Regards,

                      Pedro
                      (StataMP 16 user)

                      Comment


                      • #12
                        I would be happy to troubleshoot this, but you have to give me a suitable data example. The example you show doesn't even have the ff17 variable! Nor the Company variable. Please send a suitable data example, one that could run with the code if the code were fixed.

                        Comment


                        • #13
                          I'm sorry Clyde, for waisting your time. I intended to include the variable ff17 but somehow I forgot. I'm sorry for the inconvinience.


                          Please note that, in my case, the Company is identified by newid, which I changed in the previous code

                          I hope this helps:

                          Code:
                          * Example generated by -dataex-. To install: ssc install dataex
                          clear
                          input int year_account float(newid sample roa) byte ff17 float disc_accruals
                          1999  1 1    .05297323 13            .
                          2000  1 1    .04722103 13    .09024615
                          2001  1 1    .04962205 13   .016324334
                          2002  1 1    .04129402 13    .13728459
                          2003  1 1    .01147783 13  -.033960856
                          2004  1 1   .034888357 13     .2643016
                          2005  1 1    .04821287 13  -.006631656
                          2006  1 1    .04752731 13    .07931528
                          2007  1 1    .04293722 13    .00622189
                          2008  1 1    .01614414 13    .03889067
                          2009  1 1   .015847994 13   .006113456
                          2010  1 1   .007870924 13   .013960704
                          2011  1 1    .01865518 13    .05278258
                          2012  1 1   .019783974 13    .10658362
                          2013  1 1   .014261578 13    -.5934546
                          2014  1 1   .021104293 13   -.01029895
                          2015  1 1   .002816258 13   -.03781039
                          2016  1 1   .023566334 13     -.080952
                          2017  1 1    .02301912 13 -.0044600884
                          2018  1 1 -.0040208194 13   -.04560453
                          1999  2 1    -14.82731 17            .
                          2000  2 1     -.358747 17     1.917794
                          2001  2 1    .13859312 17     .3049665
                          2002  2 1   -.55655575 17     -.212394
                          2003  2 1    -.5580719 17   -.08579811
                          2004  2 1    -.0845492 17     .2864784
                          2005  2 1    -.9915283 17   -.27069825
                          2006  2 1    -1.237344 17   -2.4260304
                          2007  2 1   -1.2936544 17     .4025427
                          2008  2 1    -.3779378 17     .5718077
                          2009  2 1    .12664233 17     .9067148
                          2010  2 1            . 17            .
                          2011  2 1            . 17            .
                          2012  2 1            . 17            .
                          2013  2 1            . 17            .
                          2014  2 1            . 17            .
                          2015  2 1            . 17            .
                          2016  2 1            . 17            .
                          2017  2 1            . 17            .
                          2018  2 1            . 17            .
                          1999  3 1    .07218115  2            .
                          2000  3 1    .06083666  2  -.004911702
                          2001  3 1    .04736265  2    .06313091
                          2002  3 1    .04330914  2     .6048537
                          2003  3 1    .04338196  2  -.008850331
                          2004  3 1    .05440877  2   -.12301183
                          2005  3 1    .08034838  2    4.7442255
                          2006  3 1    .09727177  2    .57769996
                          2007  3 1     .0978115  2   -.11531712
                          2008  3 1    .05462816  2    .12141158
                          2009  3 1   .026058545  2     1.149373
                          2010  3 1     .0312283  2   -.20981097
                          2011  3 1    .02596144  2    1.5389977
                          2012  3 1   .026566265  2     .3594318
                          2013  3 1   .037064556  2     .1881615
                          2014  3 1    .02075909  2   -2.0355942
                          2015  3 1    .04130294  2    -2.011616
                          2016  3 1    .05802171  2    -1.656347
                          2017  3 1    .05039894  2    .07215158
                          2018  3 1    .04912275  2   -.02138325
                          1999  4 1   -.14504588 11            .
                          2000  4 1   -.29004258 11    1.1608964
                          2001  4 1     -.478722 11     12.95528
                          2002  4 1   -.05216377 11    -.3005751
                          2003  4 1   .014631253 11    .07030144
                          2004  4 1   -.08067302 11   -2.0627544
                          2005  4 1   .020376414 11    .25636378
                          2006  4 1    .05344269 11  -.009007225
                          2007  4 1    .07122867 11    .07132762
                          2008  4 1    -.3285307 11    .20918407
                          2009  4 1            . 11            .
                          2010  4 1            . 11            .
                          2011  4 1            . 11            .
                          2012  4 1            . 11            .
                          2013  4 1            . 11            .
                          2014  4 1            . 11            .
                          2015  4 1            . 11            .
                          2016  4 1            . 11            .
                          2017  4 1            . 11            .
                          2018  4 1            . 11            .
                          1999  5 0    .03010797 16            .
                          2000  5 0   .036159616 16    .24273594
                          2001  5 0    .02844329 16   -.08216827
                          2002  5 0   .029099787 16     5.766394
                          2003  5 0    .02717819 16   -.10648544
                          2004  5 0     .0811325 16    -2.572456
                          2005  5 0    .11299005 16    .01923851
                          2006  5 0    .08987702 16   -.02080251
                          2007  5 0    .08382182 16   -.10154645
                          2008  5 0    .07272602 16    2.6821415
                          2009  5 0     .1387264 16    1.1088454
                          2010  5 0    .09205497 16    -.2174717
                          2011  5 0     .1074222 16   .018320296
                          2012  5 0    .08923771 16    1.0745236
                          2013  5 0    .10090785 16   -.04078472
                          2014  5 0    .04049423 16    -.7202538
                          2015  5 0    .01990503 16   -.03871505
                          2016  5 0     .0789244 16     .1661955
                          2017  5 0    .05071925 16   -.04277562
                          2018  5 0    .03675954 16   -.05682773
                          1999  6 1    .05925784  1            .
                          2000  6 1    .04948911  1  -.032772332
                          2001  6 1    .07676751  1   -.03843554
                          2002  6 1    .08448114  1     .8242267
                          2003  6 1    .10889224  1   -.08619585
                          2004  6 1     .0944295  1    .16260454
                          2005  6 1    .10612252  1     .5457112
                          2006  6 1    .09126235  1    .23077376
                          2007  6 1    .09242576  1  -.009771827
                          2008  6 1    .07712729  1    -.1240514
                          2009  6 1    .09466335  1    -.9885554
                          2010  6 1    .11522894  1    2.1733575
                          2011  6 1     .1396636  1   -11.249427
                          2012  6 1     .1619731  1     .3515317
                          2013  6 1     .1724553  1   -4.6717234
                          2014  6 1    .18308175  1     .6736038
                          2015  6 1     .1737782  1     .1523068
                          2016  6 1    .16622277  1     .2281664
                          2017  6 1     .1499852  1   -1.0364679
                          2018  6 1     .1729187  1    .03598713
                          1999  7 1     -.263925 17            .
                          2000  7 1   -.05542682 17      -.52684
                          2001  7 1    -.4825528 17    -.2323525
                          2002  7 1    -.7156748 17    -.3272684
                          2003  7 1    -.6487582 17    -.8405118
                          2004  7 1    .03783191 17    1.4859103
                          2005  7 1    .05328875 17     .8256664
                          2006  7 1    -.2271888 17    1.8741633
                          2007  7 1   -.12658694 17     .0947522
                          2008  7 1   -1.6784878 17   -2.2246463
                          2009  7 1    -.2218498 17     2.782697
                          2010  7 1   -.12164882 17     .4492482
                          2011  7 1    -.9822637 17    .05423291
                          2012  7 1   -.05301284 17            .
                          2013  7 1            . 17            .
                          2014  7 1            . 17            .
                          2015  7 1            . 17            .
                          2016  7 1            . 17            .
                          2017  7 1            . 17            .
                          2018  7 1            . 17            .
                          1999  8 0    -.3899321  9            .
                          2000  8 0    -.3758144  9    -.7211298
                          2001  8 0            .  9            .
                          2002  8 0            .  9            .
                          2003  8 0            .  9            .
                          2004  8 0            .  9            .
                          2005  8 0            .  9            .
                          2006  8 0            .  9            .
                          2007  8 0            .  9            .
                          2008  8 0            .  9            .
                          2009  8 0            .  9            .
                          2010  8 0            .  9            .
                          2011  8 0            .  9            .
                          2012  8 0            .  9            .
                          2013  8 0            .  9            .
                          2014  8 0            .  9            .
                          2015  8 0            .  9            .
                          2016  8 0            .  9            .
                          2017  8 0            .  9            .
                          2018  8 0            .  9            .
                          1999  9 1  .0028034225 17            .
                          2000  9 1   .001498524 17  -.007435531
                          2001  9 1   .005479339 17   .015226982
                          2002  9 1  -.025108473 17    -.2060075
                          2003  9 1   .006638119 17   -.15450618
                          2004  9 1   .000980627 17    .51966673
                          2005  9 1 -.0007817965 17    .29275414
                          2006  9 1  -.016023656 17     .3070716
                          2007  9 1  -.002870261 17  .0037674275
                          2008  9 1  -.016827522 17   -.06019524
                          2009  9 1     -.371212 17    .04646767
                          2010  9 1    -.2470532 17     .1979494
                          2011  9 1  -.032928586 17    .06841366
                          2012  9 1    .07686438 17   .073946096
                          2013  9 1     .1673088 17   .020759607
                          2014  9 1    .16508886 17     .2292361
                          2015  9 1   -.29653275 17   -2.0132983
                          2016  9 1   .006677069 17     .1784036
                          2017  9 1    .04534144 17   -.02079126
                          2018  9 1    .25072655 17    1.6993368
                          1999 10 0    .13614841 10            .
                          2000 10 0     .0393614 10    .17599373
                          2001 10 0   -.05930016 10   -.03630375
                          2002 10 0    .05652552 10  -.028200237
                          2003 10 0     .1179881 10     .2281544
                          2004 10 0      .136202 10   -.17131576
                          2005 10 0    .01420924 10   -.02802866
                          2006 10 0    .12926665 10   -.04658362
                          2007 10 0    .17353778 10     .1497105
                          2008 10 0    .15434925 10  -.006525019
                          2009 10 0     .2806929 10   -.08517844
                          2010 10 0            . 10            .
                          2011 10 0            . 10            .
                          2012 10 0            . 10            .
                          2013 10 0            . 10            .
                          2014 10 0            . 10            .
                          2015 10 0            . 10            .
                          2016 10 0            . 10            .
                          2017 10 0            . 10            .
                          2018 10 0            . 10            .
                          end
                          format %ty year_account
                          Variables:
                          newid - idintifies the company
                          year_account - year of accounting data
                          sample==1 if firm is a sample firm and sample==0 if is a control firm
                          roa - return on assets
                          ff17 - industry identification
                          disc_accruals - discrecionary accruals (DA in the case of Lara's data).

                          Again, thank you very much for your willingness to help.
                          Best Regards,

                          Pedro
                          (StataMP 16 user)

                          Comment


                          • #14
                            OK, I've uncovered a few problems.

                            First, -runby slipt_one_ff17, by(ff17) status- is a typo: it should be -runby split_one_ff17, by(ff17) status-.

                            And program match_one_ff17 has a logic error: -joinby ff17 year_account using `""'`ff17'"' should be -joinby ff17 year_account using `controls'-. But with that control comes a great simplification: it is no longer necessary to create the disk files for each separate ff17, as now they are never used.

                            I think that with those corrections, the code looks like this and would work with suitable data:
                            Code:
                            * Example generated by -dataex-. To install: ssc install dataex
                            clear
                            input int year_account float(newid sample roa) byte ff17 float disc_accruals
                            1999  1 1    .05297323 13            .
                            2000  1 1    .04722103 13    .09024615
                            2001  1 1    .04962205 13   .016324334
                            2002  1 1    .04129402 13    .13728459
                            2003  1 1    .01147783 13  -.033960856
                            2004  1 1   .034888357 13     .2643016
                            2005  1 1    .04821287 13  -.006631656
                            2006  1 1    .04752731 13    .07931528
                            2007  1 1    .04293722 13    .00622189
                            2008  1 1    .01614414 13    .03889067
                            2009  1 1   .015847994 13   .006113456
                            2010  1 1   .007870924 13   .013960704
                            2011  1 1    .01865518 13    .05278258
                            2012  1 1   .019783974 13    .10658362
                            2013  1 1   .014261578 13    -.5934546
                            2014  1 1   .021104293 13   -.01029895
                            2015  1 1   .002816258 13   -.03781039
                            2016  1 1   .023566334 13     -.080952
                            2017  1 1    .02301912 13 -.0044600884
                            2018  1 1 -.0040208194 13   -.04560453
                            1999  2 1    -14.82731 17            .
                            2000  2 1     -.358747 17     1.917794
                            2001  2 1    .13859312 17     .3049665
                            2002  2 1   -.55655575 17     -.212394
                            2003  2 1    -.5580719 17   -.08579811
                            2004  2 1    -.0845492 17     .2864784
                            2005  2 1    -.9915283 17   -.27069825
                            2006  2 1    -1.237344 17   -2.4260304
                            2007  2 1   -1.2936544 17     .4025427
                            2008  2 1    -.3779378 17     .5718077
                            2009  2 1    .12664233 17     .9067148
                            2010  2 1            . 17            .
                            2011  2 1            . 17            .
                            2012  2 1            . 17            .
                            2013  2 1            . 17            .
                            2014  2 1            . 17            .
                            2015  2 1            . 17            .
                            2016  2 1            . 17            .
                            2017  2 1            . 17            .
                            2018  2 1            . 17            .
                            1999  3 1    .07218115  2            .
                            2000  3 1    .06083666  2  -.004911702
                            2001  3 1    .04736265  2    .06313091
                            2002  3 1    .04330914  2     .6048537
                            2003  3 1    .04338196  2  -.008850331
                            2004  3 1    .05440877  2   -.12301183
                            2005  3 1    .08034838  2    4.7442255
                            2006  3 1    .09727177  2    .57769996
                            2007  3 1     .0978115  2   -.11531712
                            2008  3 1    .05462816  2    .12141158
                            2009  3 1   .026058545  2     1.149373
                            2010  3 1     .0312283  2   -.20981097
                            2011  3 1    .02596144  2    1.5389977
                            2012  3 1   .026566265  2     .3594318
                            2013  3 1   .037064556  2     .1881615
                            2014  3 1    .02075909  2   -2.0355942
                            2015  3 1    .04130294  2    -2.011616
                            2016  3 1    .05802171  2    -1.656347
                            2017  3 1    .05039894  2    .07215158
                            2018  3 1    .04912275  2   -.02138325
                            1999  4 1   -.14504588 11            .
                            2000  4 1   -.29004258 11    1.1608964
                            2001  4 1     -.478722 11     12.95528
                            2002  4 1   -.05216377 11    -.3005751
                            2003  4 1   .014631253 11    .07030144
                            2004  4 1   -.08067302 11   -2.0627544
                            2005  4 1   .020376414 11    .25636378
                            2006  4 1    .05344269 11  -.009007225
                            2007  4 1    .07122867 11    .07132762
                            2008  4 1    -.3285307 11    .20918407
                            2009  4 1            . 11            .
                            2010  4 1            . 11            .
                            2011  4 1            . 11            .
                            2012  4 1            . 11            .
                            2013  4 1            . 11            .
                            2014  4 1            . 11            .
                            2015  4 1            . 11            .
                            2016  4 1            . 11            .
                            2017  4 1            . 11            .
                            2018  4 1            . 11            .
                            1999  5 0    .03010797 16            .
                            2000  5 0   .036159616 16    .24273594
                            2001  5 0    .02844329 16   -.08216827
                            2002  5 0   .029099787 16     5.766394
                            2003  5 0    .02717819 16   -.10648544
                            2004  5 0     .0811325 16    -2.572456
                            2005  5 0    .11299005 16    .01923851
                            2006  5 0    .08987702 16   -.02080251
                            2007  5 0    .08382182 16   -.10154645
                            2008  5 0    .07272602 16    2.6821415
                            2009  5 0     .1387264 16    1.1088454
                            2010  5 0    .09205497 16    -.2174717
                            2011  5 0     .1074222 16   .018320296
                            2012  5 0    .08923771 16    1.0745236
                            2013  5 0    .10090785 16   -.04078472
                            2014  5 0    .04049423 16    -.7202538
                            2015  5 0    .01990503 16   -.03871505
                            2016  5 0     .0789244 16     .1661955
                            2017  5 0    .05071925 16   -.04277562
                            2018  5 0    .03675954 16   -.05682773
                            1999  6 1    .05925784  1            .
                            2000  6 1    .04948911  1  -.032772332
                            2001  6 1    .07676751  1   -.03843554
                            2002  6 1    .08448114  1     .8242267
                            2003  6 1    .10889224  1   -.08619585
                            2004  6 1     .0944295  1    .16260454
                            2005  6 1    .10612252  1     .5457112
                            2006  6 1    .09126235  1    .23077376
                            2007  6 1    .09242576  1  -.009771827
                            2008  6 1    .07712729  1    -.1240514
                            2009  6 1    .09466335  1    -.9885554
                            2010  6 1    .11522894  1    2.1733575
                            2011  6 1     .1396636  1   -11.249427
                            2012  6 1     .1619731  1     .3515317
                            2013  6 1     .1724553  1   -4.6717234
                            2014  6 1    .18308175  1     .6736038
                            2015  6 1     .1737782  1     .1523068
                            2016  6 1    .16622277  1     .2281664
                            2017  6 1     .1499852  1   -1.0364679
                            2018  6 1     .1729187  1    .03598713
                            1999  7 1     -.263925 17            .
                            2000  7 1   -.05542682 17      -.52684
                            2001  7 1    -.4825528 17    -.2323525
                            2002  7 1    -.7156748 17    -.3272684
                            2003  7 1    -.6487582 17    -.8405118
                            2004  7 1    .03783191 17    1.4859103
                            2005  7 1    .05328875 17     .8256664
                            2006  7 1    -.2271888 17    1.8741633
                            2007  7 1   -.12658694 17     .0947522
                            2008  7 1   -1.6784878 17   -2.2246463
                            2009  7 1    -.2218498 17     2.782697
                            2010  7 1   -.12164882 17     .4492482
                            2011  7 1    -.9822637 17    .05423291
                            2012  7 1   -.05301284 17            .
                            2013  7 1            . 17            .
                            2014  7 1            . 17            .
                            2015  7 1            . 17            .
                            2016  7 1            . 17            .
                            2017  7 1            . 17            .
                            2018  7 1            . 17            .
                            1999  8 0    -.3899321  9            .
                            2000  8 0    -.3758144  9    -.7211298
                            2001  8 0            .  9            .
                            2002  8 0            .  9            .
                            2003  8 0            .  9            .
                            2004  8 0            .  9            .
                            2005  8 0            .  9            .
                            2006  8 0            .  9            .
                            2007  8 0            .  9            .
                            2008  8 0            .  9            .
                            2009  8 0            .  9            .
                            2010  8 0            .  9            .
                            2011  8 0            .  9            .
                            2012  8 0            .  9            .
                            2013  8 0            .  9            .
                            2014  8 0            .  9            .
                            2015  8 0            .  9            .
                            2016  8 0            .  9            .
                            2017  8 0            .  9            .
                            2018  8 0            .  9            .
                            1999  9 1  .0028034225 17            .
                            2000  9 1   .001498524 17  -.007435531
                            2001  9 1   .005479339 17   .015226982
                            2002  9 1  -.025108473 17    -.2060075
                            2003  9 1   .006638119 17   -.15450618
                            2004  9 1   .000980627 17    .51966673
                            2005  9 1 -.0007817965 17    .29275414
                            2006  9 1  -.016023656 17     .3070716
                            2007  9 1  -.002870261 17  .0037674275
                            2008  9 1  -.016827522 17   -.06019524
                            2009  9 1     -.371212 17    .04646767
                            2010  9 1    -.2470532 17     .1979494
                            2011  9 1  -.032928586 17    .06841366
                            2012  9 1    .07686438 17   .073946096
                            2013  9 1     .1673088 17   .020759607
                            2014  9 1    .16508886 17     .2292361
                            2015  9 1   -.29653275 17   -2.0132983
                            2016  9 1   .006677069 17     .1784036
                            2017  9 1    .04534144 17   -.02079126
                            2018  9 1    .25072655 17    1.6993368
                            1999 10 0    .13614841 10            .
                            2000 10 0     .0393614 10    .17599373
                            2001 10 0   -.05930016 10   -.03630375
                            2002 10 0    .05652552 10  -.028200237
                            2003 10 0     .1179881 10     .2281544
                            2004 10 0      .136202 10   -.17131576
                            2005 10 0    .01420924 10   -.02802866
                            2006 10 0    .12926665 10   -.04658362
                            2007 10 0    .17353778 10     .1497105
                            2008 10 0    .15434925 10  -.006525019
                            2009 10 0     .2806929 10   -.08517844
                            2010 10 0            . 10            .
                            2011 10 0            . 10            .
                            2012 10 0            . 10            .
                            2013 10 0            . 10            .
                            2014 10 0            . 10            .
                            2015 10 0            . 10            .
                            2016 10 0            . 10            .
                            2017 10 0            . 10            .
                            2018 10 0            . 10            .
                            end
                            format %ty year_account
                            
                            capture program drop match_one_ff17
                            program define match_one_ff17
                                preserve
                                local local ff17 = strtoname(string(ff17[1], 1)
                                keep if sample == 0
                                ds ff17 year_account, not
                                rename (`r(varlist)') =_ctrl
                                tempfile controls
                                save `controls', replace
                                restore
                                keep if sample == 1
                                gen long obs_no = _n
                                joinby ff17 year_account using `controls'
                                drop if missing(newid_ctrl)
                                gen delta = abs(roa-roa_ctrl)
                                gen double shuffle1 = runiform()
                                gen double shuffle2 = runiform()
                                by obs_no (delta shuffle1 shuffle2), sort: keep if _n == 1
                                exit
                            end
                            
                            runby match_one_ff17, by(ff17) status

                            But the code still does not run because there is a more serious problem than any of this: your data are incapable of supporting this kind of matching. For each value of ff17, the companies are either all cases or all controls. So it is impossible to match a case with a control from the same ff17. You need to rethink this entire project. (As it happens, because either the case subset or the control subset is always empty, the -joinby- command fails and exits with an error. But there is nothing wrong with the joinby command, it is just recognizing the fact that there is nothing to join!)


                            Comment


                            • #15
                              Clyde,

                              It works perfectly! Can't thank you enough.

                              All you wrote after the code is absolutely right for the data sample I provided - the first 200 observations. In fact I have 227830 observations and, by (unlucky) chance, the sample doesn't reflect the population. For each ff17 classification I have firms from both sample and control groups as in the following example.

                              Code:
                              * Example generated by -dataex-. To install: ssc install dataex
                              clear
                              input int year_account float(newid sample roa) byte ff17 float disc_accruals
                              1999  8934 0           . 14 .
                              1999  1532 1   .00603676 17 .
                              1999 10479 0           . 16 .
                              1999  2926 0  -.13547996 17 .
                              1999    24 0           . 17 .
                              1999  2367 1  -.05246037 17 .
                              1999  2761 1           .  1 .
                              1999  6606 0  .025543926 16 .
                              1999  6453 1           .  3 .
                              1999  7183 0           .  1 .
                              1999  8228 0   -.4591988 17 .
                              1999  9050 0 -.033828538 17 .
                              1999  1121 1           .  1 .
                              1999  8362 1           .  3 .
                              1999  5944 0   .11472603 17 .
                              1999  7389 1           .  3 .
                              1999  9159 0           . 17 .
                              1999  9144 0           . 17 .
                              1999  5745 1  -.12635629  7 .
                              1999  5669 0           . 11 .
                              1999  3430 0   -.6527778  7 .
                              1999  4160 1           . 11 .
                              1999  9229 0  -2.1488395 10 .
                              1999  5317 1  -.11381266  3 .
                              1999  7987 0           .  7 .
                              1999   919 0   -.1053673  3 .
                              1999   657 0  -.03650121 17 .
                              1999 10239 0           . 17 .
                              1999 11139 1   .01612768 17 .
                              1999  2245 1           . 17 .
                              1999    36 1   -.1074586  9 .
                              1999  3202 1   .05479244  8 .
                              1999  8107 0           .  7 .
                              1999   917 0           .  3 .
                              1999  6722 1 .0009189065 17 .
                              1999  9743 0           .  3 .
                              1999  9395 1   .07069488  7 .
                              1999  4671 1    .0472182 12 .
                              1999  8755 1           .  3 .
                              1999   291 1   -.5528021 17 .
                              1999 10140 0  .069812074  1 .
                              1999 10412 0           . 17 .
                              1999 11111 0           .  1 .
                              1999   891 1           .  3 .
                              1999  2518 1           .  2 .
                              1999 10117 0           .  1 .
                              1999  2798 1           . 17 .
                              1999  5503 0   -.1494538  2 .
                              1999  4931 1   -.6670902 17 .
                              1999 11168 1           .  1 .
                              1999  7116 0           . 17 .
                              1999  9657 0           . 15 .
                              1999 10110 0   .05362595 16 .
                              1999  2116 0           . 17 .
                              1999  5449 0  -.03178471 15 .
                              1999  9286 0   .04760225 14 .
                              1999 10163 0           . 16 .
                              1999  4999 0           . 17 .
                              1999  2693 1           . 17 .
                              1999  3145 0   .02609603  9 .
                              1999   320 0   -.3793103 17 .
                              1999     3 1   .07218115  2 .
                              1999  4298 0           .  2 .
                              1999  4100 1           . 17 .
                              1999  6346 0           . 15 .
                              1999  6022 0           . 13 .
                              1999  4728 0           . 17 .
                              1999  7780 0  -1.8422886 17 .
                              1999  4850 1           .  6 .
                              1999  1952 0    .3085403 14 .
                              1999 10931 1   .07561134 15 .
                              1999  4199 1           .  3 .
                              1999  2475 0           .  1 .
                              1999  7283 1           . 17 .
                              1999  1528 0           . 16 .
                              1999  3824 0           .  7 .
                              1999 10443 0   .02780805 13 .
                              1999  8714 1   -.0098518 11 .
                              1999 11249 0  -.07236287 14 .
                              1999  8178 0  .007782039  2 .
                              1999  7990 0  -.12419822 17 .
                              1999   705 0           .  3 .
                              1999  6800 0           . 16 .
                              1999  1095 1   .05292772  3 .
                              1999  3649 0    .5106383 17 .
                              1999 11334 1  .022064105  . .
                              1999  4284 0           . 17 .
                              1999   943 1  .018247366 13 .
                              1999  3999 1           .  3 .
                              1999  2464 1  -.11290736 17 .
                              1999  9989 0 -.011634487  1 .
                              1999  5295 0   .05046357 16 .
                              1999  5178 1    .1217758  5 .
                              1999  3429 1           . 17 .
                              1999  2916 0           . 16 .
                              1999  1724 0  .024550805  8 .
                              1999  4493 0           . 16 .
                              1999  9955 0           .  1 .
                              1999 10571 0           . 17 .
                              1999  6717 0   -.2360631 11 .
                              end
                              format %ty year_account
                              Again, thank you very much for your pacience.
                              Best Regards,

                              Pedro
                              (StataMP 16 user)

                              Comment

                              Working...
                              X