Announcement

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

  • rangerun after rangestat?

    Dear All,
    1. I asked a (probably too complicated) question (or I didn't make myself clear) in this thread https://www.statalist.org/forums/for...values-and-sum but got no response.
    2. I figure out that I can use -rangestat- command to estimate equation (1), for each firm-year, using 8 previous quarters (2 years) of data as below (Note that I now use a more complete data set).
    3. Code:
      	* Example generated by -dataex-. To install: ssc install dataex
      	clear
      	input int Stkcd double(ret earn) float(year ind) double(b_ret b_cons)
      	1   .007696649990975857  43.763031005859375 2012 1                   .                  .
      	1   -.03500852733850479    85.3490982055664 2012 1                   .                  .
      	1     -.133904829621315  133.20423889160156 2012 1                   .                  .
      	1    .22919052839279175  200.84527587890625 2012 1                   .                  .
      	1     .2559305727481842  43.727725982666016 2013 1   250.3708536493786 111.53574507155234
      	1   -.19962303340435028   73.05847930908203 2013 1   250.3708536493786 111.53574507155234
      	1    .19157494604587555  143.10939025878906 2013 1   250.3708536493786 111.53574507155234
      	1    .03114444576203823  156.40042114257812 2013 1   250.3708536493786 111.53574507155234
      	1   -.12081636488437653   50.32978820800781 2014 1   81.57574377583794 106.39385202411387
      	1    .11934009939432144   98.22659301757813 2014 1   81.57574377583794 106.39385202411387
      	1   .023208416998386383  138.61422729492187 2014 1   81.57574377583794 106.39385202411387
      	1     .5621297359466553  170.93023681640625 2014 1   81.57574377583794 106.39385202411387
      	1  -.005682411603629589   31.10454559326172 2015 1   99.98228492552718  98.51540828862993
      	1    .11752037703990936   64.38182830810547 2015 1   99.98228492552718  98.51540828862993
      	1    -.2785419225692749   85.26872253417969 2015 1   99.98228492552718  98.51540828862993
      	1    .14299383759498596  145.67147827148437 2015 1   99.98228492552718  98.51540828862993
      	1   -.11259397864341736   35.47425842285156 2016 1   130.3293235098682  88.94040238355862
      	1 -.0041998825035989285   80.73863983154297 2016 1   130.3293235098682  88.94040238355862
      	1    .04252886399626732  125.30912780761719 2016 1   130.3293235098682  88.94040238355862
      	1  .0033079085405915976  145.11129760742187 2016 1   130.3293235098682  88.94040238355862
      	1   .007692847400903702  39.769412994384766 2017 1  114.81183759595241  90.49110181300429
      	1   .023991048336029053   79.73189544677734 2017 1  114.81183759595241  90.49110181300429
      	1    .20033949613571167  118.79291534423828 2017 1  114.81183759595241  90.49110181300429
      	2    .10843338072299957    21.1660213470459 2012 1                   .                  .
      	2    .07608681917190552   56.58559799194336 2012 1                   .                  .
      	2   -.04063301905989647   71.25907897949219 2012 1                   .                  .
      	2    .20047396421432495  191.93280029296875 2012 1                   .                  .
      	2    .06324122101068497  18.265546798706055 2013 1   431.4028328552355  48.09628127797376
      	2   -.07048974186182022   51.22624588012695 2013 1   431.4028328552355  48.09628127797376
      	2    -.0730976089835167    78.4146728515625 2013 1   431.4028328552355  48.09628127797376
      	2    -.1204819530248642   206.6357879638672 2013 1   431.4028328552355  48.09628127797376
      	2    .00747232511639595  21.033597946166992 2014 1  -39.45780408848296  87.64365644422733
      	2    .07927099615335465   69.99187469482422 2014 1  -39.45780408848296  87.64365644422733
      	2    .11003623157739639      94.80224609375 2014 1  -39.45780408848296  87.64365644422733
      	2     .5141599774360657  216.60020446777344 2014 1  -39.45780408848296  87.64365644422733
      	2  -.005754666868597269   6.718979835510254 2015 1  165.35962827091322  84.07729217175718
      	2     .0506519190967083   50.52988815307617 2015 1  165.35962827091322  84.07729217175718
      	2   -.09306689351797104   67.49441528320313 2015 1  165.35962827091322  84.07729217175718
      	2       .91908860206604  209.54843139648437 2015 1  165.35962827091322  84.07729217175718
      	2    -.2147500216960907  111.40367889404297 2016 1  206.61297689778746  51.23589325024565
      	2  .0014597486006096005   5.550509929656982 2017 1  130.41655255662448   72.0240205265508
      	2     .2133135050535202   50.23381423950195 2017 1  130.41655255662448   72.0240205265508
      	2    .08681178838014603    61.0202751159668 2017 1  130.41655255662448   72.0240205265508
      	4  .0049445428885519505  1.7107731103897095 2012 1                   .                  .
      	4    .04181978479027748  2.0242059230804443 2012 1                   .                  .
      	4   -.04132254794239998   4.945676803588867 2012 1                   .                  .
      	4   .007388699799776077   11.45964527130127 2012 1                   .                  .
      	4    .16625899076461792   4.137348651885986 2013 1  -26.09586991637258  5.118780908325447
      	4     .0482185073196888      5.187255859375 2013 1  -26.09586991637258  5.118780908325447
      	4    .27300041913986206   8.921060562133789 2013 1  -26.09586991637258  5.118780908325447
      	4   -.08483946323394775   5.422473430633545 2013 1  -26.09586991637258  5.118780908325447
      	4    .09613719582557678 -3.4672744274139404 2014 1   6.531478251813688  5.136851663594566
      	4    .08692249655723572  -4.418781280517578 2014 1   6.531478251813688  5.136851663594566
      	4    .34870338439941406  -3.443899154663086 2014 1   6.531478251813688  5.136851663594566
      	4    -.1682698130607605   9.939173698425293 2014 1   6.531478251813688  5.136851663594566
      	4     .5401414632797241  -1.343976378440857 2015 1 -13.709171538018968  4.097548559835706
      	4     .6055042743682861  2.1902618408203125 2015 1 -13.709171538018968  4.097548559835706
      	4   -.34129878878593445   2.301856279373169 2015 1 -13.709171538018968  4.097548559835706
      	4     .8099364042282105   3.219851016998291 2015 1 -13.709171538018968  4.097548559835706
      	4   -.19760337471961975  -.7404028177261353 2016 1  -2.163699481616878 1.1570657293913968
      	4    .19861237704753876  12.625322341918945 2016 1  -2.163699481616878 1.1570657293913968
      	4   -.19821792840957642 -.44819581508636475 2017 1   .1511543888455824 3.0014589590255905
      	4    -.2874999940395355 -1.9039255380630493 2017 1   .1511543888455824 3.0014589590255905
      	4   -.06159806624054909 -3.8107426166534424 2017 1   .1511543888455824 3.0014589590255905
      	5   -.05315576493740082  -4.864426612854004 2012 1                   .                  .
      	5    .04210561141371727   8.450836181640625 2012 1                   .                  .
      	5   -.09090884774923325  -3.400902032852173 2013 1                   .                  .
      	5   -.15555503964424133  -9.096631050109863 2013 1                   .                  .
      	5    .07894653081893921 -13.911046028137207 2013 1                   .                  .
      	5   .016261205077171326  -18.82607650756836 2013 1                   .                  .
      	5   .012000244110822678 -3.7982757091522217 2014 1 -4.9121789231354285 -7.074253943416227
      	5   -.10671987384557724 -10.902318954467773 2014 1 -4.9121789231354285 -7.074253943416227
      	5     .7477884292602539 -15.460854530334473 2014 1 -4.9121789231354285 -7.074253943416227
      	5   .037974897772073746  11.951415061950684 2014 1 -4.9121789231354285 -7.074253943416227
      	5   -.32679733633995056 -3.5546228885650635 2015 1   -9.37708624400568 -7.297881922532834
      	5      .624596357345581  -9.562151908874512 2015 1   -9.37708624400568 -7.297881922532834
      	5   -.23605568706989288  -.6041566133499146 2016 1 -10.636265770230278 -3.468202495435589
      	5   -.01694917492568493    16.1798038482666 2016 1 -10.636265770230278 -3.468202495435589
      	5  -.027851246297359467   17.77695083618164 2016 1 -10.636265770230278 -3.468202495435589
      	5   -.07776278257369995  15.074273109436035 2016 1 -10.636265770230278 -3.468202495435589
      	5   -.07396496832370758 -1.3565131425857544 2017 1 -11.181358473514141  5.771674602644399
      	5   -.16293977200984955  -2.272408962249756 2017 1 -11.181358473514141  5.771674602644399
      	5  -.036259040236473083 -1.9964791536331177 2017 1 -11.181358473514141  5.771674602644399
      	6     .3439035415649414  20.807355880737305 2012 2                   .                  .
      	6    .03629857674241066  49.515106201171875 2012 2                   .                  .
      	6   -.08083932846784592   61.64518737792969 2012 2                   .                  .
      	6     .2344132512807846  122.11065673828125 2012 2                   .                  .
      	6   -.09090826660394669   9.778822898864746 2013 2 -11.936866884032497  65.11247993671472
      	6    .01617056131362915   46.89581298828125 2013 2 -11.936866884032497  65.11247993671472
      	6    .08450716733932495   62.71464157104492 2013 2 -11.936866884032497  65.11247993671472
      	6    .06709986180067062   111.9146499633789 2013 2 -11.936866884032497  65.11247993671472
      	6    .09330663084983826   4.537078857421875 2014 2   53.17936131727416  56.61356288990416
      	6   -.12177072465419769   6.690219402313232 2014 2   53.17936131727416  56.61356288990416
      	6    .27947667241096497   38.55535888671875 2014 2   53.17936131727416  56.61356288990416
      	6    .20307159423828125   64.77758026123047 2014 2   53.17936131727416  56.61356288990416
      	6    .24822726845741272  22.119033813476563 2015 2  103.76637417992296  36.34613070238843
      	6      .553745687007904   22.59101104736328 2015 2  103.76637417992296  36.34613070238843
      	6   -.30729520320892334  15.699004173278809 2015 2  103.76637417992296  36.34613070238843
      	6     .2244689017534256   34.57742691040039 2015 2  103.76637417992296  36.34613070238843
      	6   -.27888813614845276   3.213345527648926 2016 2   28.40571198403756 22.027532049221797
      	6   -.09731023758649826   9.462743759155273 2016 2   28.40571198403756 22.027532049221797
      	6    .31071972846984863  12.038106918334961 2016 2   28.40571198403756 22.027532049221797
      	6    -.0217384435236454   61.64247512817383 2016 2   28.40571198403756 22.027532049221797
      	6   -.12381055951118469   8.825848579406738 2017 2  11.115722179453737 21.789849224231453
      	6    .08592195063829422  23.555709838867188 2017 2  11.115722179453737 21.789849224231453
      	6    .11804693192243576  29.731189727783203 2017 2  11.115722179453737 21.789849224231453
      	7     .7538010478019714  .24515913426876068 2012 2                   .                  .
      	7     .2859620749950409   1.521431803703308 2012 2                   .                  .
      	7   .037061505019664764   2.824248790740967 2012 2                   .                  .
      	7   -.05977896973490715   1.247214913368225 2012 2                   .                  .
      	7    .09053147584199905  -3.462310791015625 2013 2 -2.1052663107087626 1.9948016506233583
      	7   -.16032932698726654  -.7407301068305969 2013 2 -2.1052663107087626 1.9948016506233583
      	7   .012075320817530155  11.717114448547363 2013 2 -2.1052663107087626 1.9948016506233583
      	7    .03504834696650505  6.0797905921936035 2013 2 -2.1052663107087626 1.9948016506233583
      	7   -.12463978677988052  -2.445725917816162 2014 2 -2.8333893070007967  2.781170036079474
      	7    -.1225961297750473  -8.686015129089356 2014 2 -2.8333893070007967  2.781170036079474
      	7    .31164389848709106 -1.8441765308380127 2015 2  30.547386015645596 1.7845285179416073
      	7    .05386490747332573   14.52142333984375 2016 2   8.499844504551897 -4.507791803006302
      	end
    4. The code for the above result is
      Code:
      rangestat (reg) earn ret, interval(year -2 -1) by(Stkcd)
      	keep Stkcd year ret earn ind b_*
      	dataex, count(130)
    5. Now, my next step is, say for year 2014, using quarterly data in 2012 and 2013 from Stkcd=1, and coefficients estimates for all firms in the same industry (ind=1, just ignore ind=2 at this moment) in year 2014 (for Stkcd=1, they are b_ret=81.575744 and b_cons=106.39385; for Stck=2, they are b_ret=431.40283 and b_cons=48.096281, and so on) to obtain predicted earn as in equations (2) and (3) as shown in the prior thread. I suspect that this can be done using -rangerun- command by writing a small procedure, but I am unable to do so. Any suggestion is highly appreciated.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    I don't think you are doing this right. In the thread you created earlier, you have quarterly data and the quote from the paper mentions quarterly data. So you must perform rolling regressions on a window of 8 quarters. The notation in the paper is pretty sloppy in terms of the time periods. Taking it as a whole and working backwards from equation (4), I'll assume that you need to calculate a measure for paired firms ( ij ) at time t using an 8 quarter window that includes time t (i.e. t-7 to t). You will also have to create all pairwise combinations of firms within each industry in order to create the desired measure.

    I can't really use the data example you provide to work out a solution so I'll create a demonstration dataset with 50 firms in 10 industries, each with 40 quarters of data. I use runby (from SSC) to process data by industry groups. Within each industry, the pair_by_quarters program forms all pairwise combinations of firms per quarter (dropping self-self pairing and reversed pairings). Then rangerun (from SSC) is used to perform the rolling regressions within paired firms on an 8 quarter window that ends with the current observation. The get_CompAcct program performs the regressions using on firm and firm2 data, the coefficients for firm2 are used with data from firm to calculate the second set of predicted earnings.

    Code:
    clear all
    set seed 3123
    
    * demonstration dataset, 50 firms over 40 quarters in 10 industry
    set obs 50
    gen firmid = _n
    gen industry = runiformint(1,10)
    expand 70
    bysort firmid: gen qdate = yq(1999,4) + _n
    format %tq qdate
    gen returns = runiform()
    gen earnings = runiform()
    
    program get_CompAcct
        reg earnings returns
        predict pearn, xb
        reg earnings2 returns2
        gen pearn2 =  _b[returns2] * returns + _b[_cons]
        count if !mi(pearn,pearn2)
        
        gen CompAcct_nobs = r(N)
        gen CompAcct = -sum(abs(pearn-pearn2)) / CompAcct_nobs
        drop pearn pearn2
    end
    
    program pair_by_quarters
        tempfile hold
        save "`hold'"
        rename (firmid returns earnings) (firmid2 returns2 earnings2)
        joinby qdate using "`hold'"
        keep if firmid < firmid2
        sort firmid firmid2 qdate
        rangerun get_CompAcct, by(firmid firmid2) interval(qdate -7 0)
    end
    runby pair_by_quarters, by(industry) verbose
    
    save "results.dta", replace
    As usual with rolling window problems, it's easy to spot check the results for a given observation. Here's code that does one case:
    Code:
    * pick a 8 quarter window for a firm pairing in the second industry
    use "results.dta", clear
    keep if firmid == 6 & firmid2 == 18
    keep if inrange(qdate, yq(2015,4) - 7, yq(2015,4))
    list firmid firmid2 qdate returns2 earnings2 returns earnings
    
    reg earnings returns
    predict pearn, xb
    reg earnings2 returns2
    gen pearn2 =  _b[returns2] * returns + _b[_cons]
    
    count if !mi(pearn,pearn2)
    gen nobs = r(N)
    gen check = -sum(abs(pearn-pearn2)) / nobs
    
    * results apply to the most recent observation within the 8 quarter window
    list in l
    and the results
    Code:
    . list in l
    
         +-----------------------------------------------------------------------+
      8. | firmid2 | industry |  qdate | returns2 | earnin~2 | firmid |  returns |
         |      18 |        2 | 2015q4 | .0269408 | .9475088 |      6 | .5701397 |
         |-----------------------------------------------------------------------|
         | earnings | CompAc~s | CompAcct |    pearn |   pearn2 | nobs |   check |
         | .7563186 |        8 |  -.23856 | .4586301 | .5550103 |    8 | -.23856 |
         +-----------------------------------------------------------------------+
    I think all of the above should correctly handle missing value cases but I have not put much thought on that question.

    Comment


    • #3
      Dear Robert, I cannot thank enough for your help and expertise.
      1. I used -interval(year -2 -1)- option rather than -interval(qdate -7 0)- (shouldn't it be -interval(qdate -8 -1)-) as yours because in the paper, it says "for each firm-year". Thus, I thought that there is only one "CompAcct" measure per firm-year. I am still puzzled now and agree with you that the notation there is sloppy (whether `t' denotes year or quarter).
      2. I doubt that there is asymmetry in the measurement of "CompAcct". In principle, "CompAcct_{ijt}" should be equal to "CompAcct_{jit}". But, according to equations (2) and (3), if we use the data of `j' rather than `i' to calculate CompAcct, I am not sure whether CompAcct_{ijt}=CompAcct_{jit}. Do you have any comment on this conjecture? Thanks.
      Last edited by River Huang; 10 Mar 2018, 19:56.
      Ho-Chuan (River) Huang
      Stata 17.0, MP(4)

      Comment


      • #4
        If you think the measure is calculated only once per year, use invalid intervals for 3 of the 4 quarters and rangerun will not perform calculations for those. As to which quarters to specify in the interval() option, that's up to you to figure out.

        With respect to your second point, I hadn't thought about that because I expected the measure would be the same when calculated between firm pair a,b and b,a. Easy enough to check and it turns out that it is not.

        Here's revised code that calculates the measure only on observations from the fourth quarter using the 8 quarters from the previous years (adjust to taste). Both direction for firm pairings are used (listsome is from SSC):

        Code:
        clear all
        set seed 3123
        
        * demonstration dataset, 50 firms over 40 quarters in 10 industry
        set obs 50
        gen firmid = _n
        gen industry = runiformint(1,10)
        expand 70
        bysort firmid: gen qdate = yq(1999,4) + _n
        format %tq qdate
        gen returns = runiform()
        gen earnings = runiform()
        
        * pick a quarter to calculate measure, use quarters in 2 previous years
        gen q2use = quarter(dofq(qdate)) == 4
        gen qlow  = cond(q2use, qdate - 11, 1)
        gen qhigh = cond(q2use, qdate - 4, 0)
        format %tq qlow qhigh
        
        program get_CompAcct
            reg earnings returns
            predict pearn, xb
            reg earnings2 returns2
            gen pearn2 =  _b[returns2] * returns + _b[_cons]
            count if !mi(pearn,pearn2)
            
            gen CompAcct_nobs = r(N)
            gen CompAcct = -sum(abs(pearn-pearn2)) / CompAcct_nobs
            drop pearn pearn2
        end
        
        program pair_by_quarters
            tempfile hold
            save "`hold'"
            rename (firmid returns earnings) (firmid2 returns2 earnings2)
            joinby qdate using "`hold'"
            keep if firmid != firmid2
            sort firmid firmid2 qdate
            rangerun get_CompAcct, by(firmid firmid2) interval(qdate qlow qhigh)
        end
        runby pair_by_quarters, by(industry) verbose
        
        save "results.dta", replace
        
        sort industry qdate firmid firmid2
        
        * to install, type: ssc install listsome
        listsome industry qdate firmid firmid2 CompAcct_nobs CompAcct ///
            if q2use & !mi(CompAcct), sepby(qdate)
        and the results that shows that the measure is not symmetric:
        Code:
        . listsome industry qdate firmid firmid2 CompAcct_nobs CompAcct if q2use & !mi(C
        > ompAcct), sepby(qdate)
        
               +-------------------------------------------------------------+
               | industry    qdate   firmid   firmid2   CompAc~s    CompAcct |
               |-------------------------------------------------------------|
           15. |        1   2001q4       30        36          4   -.2522014 |
           16. |        1   2001q4       36        30          4   -.2427484 |
               |-------------------------------------------------------------|
           23. |        1   2002q4       30        36          8   -.1902214 |
           24. |        1   2002q4       36        30          8   -.1793276 |
               |-------------------------------------------------------------|
           31. |        1   2003q4       30        36          8   -.2167097 |
           32. |        1   2003q4       36        30          8   -.2759348 |
               |-------------------------------------------------------------|
           39. |        1   2004q4       30        36          8   -.0120361 |
           40. |        1   2004q4       36        30          8   -.0090635 |
               |-------------------------------------------------------------|
           47. |        1   2005q4       30        36          8   -.1335149 |
           48. |        1   2005q4       36        30          8     -.31145 |
               |-------------------------------------------------------------|
           55. |        1   2006q4       30        36          8   -.0281201 |
           56. |        1   2006q4       36        30          8   -.0155677 |
               |-------------------------------------------------------------|
           63. |        1   2007q4       30        36          8   -.1591177 |
           64. |        1   2007q4       36        30          8   -.1545672 |
               |-------------------------------------------------------------|
           71. |        1   2008q4       30        36          8   -.0572723 |
           72. |        1   2008q4       36        30          8   -.0668007 |
               |-------------------------------------------------------------|
           79. |        1   2009q4       30        36          8   -.0771951 |
           80. |        1   2009q4       36        30          8   -.0520142 |
               |-------------------------------------------------------------|
           87. |        1   2010q4       30        36          8   -.1615385 |
           88. |        1   2010q4       36        30          8   -.2010782 |
               +-------------------------------------------------------------+
        
        .

        Comment


        • #5
          Dear Robert, Many thanks for your replies again. I'll try to figure it out.

          Ho-Chuan (River) Huang
          Stata 17.0, MP(4)

          Comment


          • #6
            Dear Robert;

            First of all thank you so much for your detailed answers for River's question. I am trying to use same model that River used for my research.
            To be able to understand the dynamics underlying the model, I am trying to replicade your code through the dataset you created.
            The thing is that, when I try to write the same code, it always gives error on;
            gen industry = runiformint(1,10) this command and says unknown function runiformint() r(133); Thus, I cannot replicate the code. Is this because my STATA is lack of some ssc programmes? Just in case, I am using STATA13. Kind Regards Faruk

            Comment


            • #7
              Indeed, the runiformint() function is newer than Stata 13 and that explains the error message you got. If you look at the help file for runiform() in Stata 13, you have the following snippet:

              To generate random integers over [a,b], use a+int((b-a+1)*runiform()).
              Here's an example that generates 100,000 random integers between 1 and 10:

              Code:
              . clear
              
              . set seed 312
              
              . set obs 100000
              obs was 0, now 100000
              
              . gen industry = 1+int((10-1+1)*runiform())
              
              . tab industry
              
                 industry |      Freq.     Percent        Cum.
              ------------+-----------------------------------
                        1 |     10,177       10.18       10.18
                        2 |      9,954        9.95       20.13
                        3 |      9,850        9.85       29.98
                        4 |      9,945        9.95       39.93
                        5 |     10,016       10.02       49.94
                        6 |      9,959        9.96       59.90
                        7 |      9,932        9.93       69.83
                        8 |     10,023       10.02       79.86
                        9 |     10,073       10.07       89.93
                       10 |     10,071       10.07      100.00
              ------------+-----------------------------------
                    Total |    100,000      100.00

              Comment


              • #8
                Consider also

                Code:
                ceil(10 * runiform())

                Comment


                • #9
                  Code:
                  ID    qdate    ID2    COMPACT    QCOMPACT
                  1    2001q1    3    -.33564    1
                  1    2001q1    15    -.304    1
                  1    2001q1    68    -.3    1
                  1    2001q1    154    -.2984    1
                  1    2001q1    24    -.2973    1
                  1    2001q1    39    -.2    1
                  1    2001q2    78    -.42    2
                  1    2001q2    51    -.4168    2
                  1    2001q2    54    -.40089    2
                  1    2001q2    987    -.4    2
                  1    2001q2    63    -.39    2
                  1    2001q2    95    -.324    2
                  1    2001q3    94    -.33    3
                  1    2001q3    73    -.301    3
                  1    2001q3    82    -.253    3
                  1    2001q3    81    -.207    3
                  1    2001q3    5    -.18    3
                  1    2001q3    9    -.139    3
                  1    2001q4    78    -.652    4
                  1    2001q4    52    -.6501    4
                  1    2001q4    94    -.61    4
                  1    2001q4    936    -.59    4
                  1    2001q4    6    -.5501    4
                  1    2001q4    91    -.52    4
                  2    2001q1    7    -1.265    5
                  2    2001q1    87    -1.098    5
                  2    2001q1    65    -.9854    5
                  2    2001q1    32    -.8512    5
                  2    2001q1    12    -.657    5
                  2    2001q1    46    -.524    5
                  2    2001q2    79    -.8412    6
                  2    2001q2    85    -.82015    6
                  2    2001q2    26    -.725    6
                  2    2001q2    59    -.652    6
                  2    2001q2    48    -.524    6
                  2    2001q2    15    -.5014    6
                  2    2001q3    3    -.982    7
                  2    2001q3    68    -.922    7
                  2    2001q3    93    -.8126    7
                  2    2001q3    96    -.735    7
                  2    2001q3    16    -.62456    7
                  2    2001q3    88    -.5921    7
                  2    2001q4    82    -.4156    8
                  2    2001q4    80    -.4056    8
                  2    2001q4    70    -.3995    8
                  2    2001q4    35    -.3524    8
                  2    2001q4    30    -.3024    8
                  2    2001q4    91    -.2574    8

                  Dear Stata Forum Users;

                  First of all I am sorry for this easy question but I couldn't find the correct way to solve my problem within the existing forum topics.
                  I completed to calculate CompAct and I generated the sample that you see above. I ranked CompAct from lower values to higher based on each ID, quarter. Now I need to keep first 3 lowest observations of CompAct. I will reach this aim by keeping first three 1s, first three 2s, first three 3s.. (and so on) of QCOMPACT. I tired to do this by using keep code but I couldn't manage to do this. I also tried collapse code but failed as well.
                  Is there any way that you can recommend to me?

                  Kind Regards

                  Omer Faruk

                  Comment


                  • #10
                    Code:
                    * Example generated by -dataex-. To install: ssc install dataex
                    clear
                    input byte id str6 qdate int id2 float compact byte qcompact
                    1 "2001q1"   3 -.33564 1
                    1 "2001q1"  15   -.304 1
                    1 "2001q1"  68     -.3 1
                    1 "2001q1" 154  -.2984 1
                    1 "2001q1"  24  -.2973 1
                    1 "2001q1"  39     -.2 1
                    1 "2001q2"  78    -.42 2
                    1 "2001q2"  51  -.4168 2
                    1 "2001q2"  54 -.40089 2
                    1 "2001q2" 987     -.4 2
                    1 "2001q2"  63    -.39 2
                    1 "2001q2"  95   -.324 2
                    1 "2001q3"  94    -.33 3
                    1 "2001q3"  73   -.301 3
                    1 "2001q3"  82   -.253 3
                    1 "2001q3"  81   -.207 3
                    1 "2001q3"   5    -.18 3
                    1 "2001q3"   9   -.139 3
                    1 "2001q4"  78   -.652 4
                    1 "2001q4"  52  -.6501 4
                    1 "2001q4"  94    -.61 4
                    1 "2001q4" 936    -.59 4
                    1 "2001q4"   6  -.5501 4
                    1 "2001q4"  91    -.52 4
                    2 "2001q1"   7  -1.265 5
                    2 "2001q1"  87  -1.098 5
                    2 "2001q1"  65  -.9854 5
                    2 "2001q1"  32  -.8512 5
                    2 "2001q1"  12   -.657 5
                    2 "2001q1"  46   -.524 5
                    2 "2001q2"  79  -.8412 6
                    2 "2001q2"  85 -.82015 6
                    2 "2001q2"  26   -.725 6
                    2 "2001q2"  59   -.652 6
                    2 "2001q2"  48   -.524 6
                    2 "2001q2"  15  -.5014 6
                    2 "2001q3"   3   -.982 7
                    2 "2001q3"  68   -.922 7
                    2 "2001q3"  93  -.8126 7
                    2 "2001q3"  96   -.735 7
                    2 "2001q3"  16 -.62456 7
                    2 "2001q3"  88  -.5921 7
                    2 "2001q4"  82  -.4156 8
                    2 "2001q4"  80  -.4056 8
                    2 "2001q4"  70  -.3995 8
                    2 "2001q4"  35  -.3524 8
                    2 "2001q4"  30  -.3024 8
                    2 "2001q4"  91  -.2574 8
                    end
                    
                    by id (compact), sort: keep if _n <= 3
                    This question, other than dealing with the same source data, really is unrelated to the original topic of the thread. In the future, in situations like this, please start a New Topic rather than adding on to an existing thread. While it is easy to feel as if these threads are dialogues between questioners and responders, in fact there are many other people on the Forum who read along to learn. They rely on the search facilities to find answers to their questions. If threads diverge from their original topic, this makes it hard for readers to find what they are looking for.

                    In the future, when showing data examples, please use the -dataex- command to do so, as I have done in this response. If you are running version 15.1 or a fully updated version 14.2, it is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

                    When asking for help with code, always show example data. When showing example data, always use -dataex-.

                    Comment


                    • #11
                      Dear Clyde

                      Thanks a lot your for your answer and warnings for my further posts. I will consider your warnings.

                      Kind Regards


                      Omer Faruk

                      Comment


                      • #12
                        Respected All,
                        I asked a question in this thread https://www.statalist.org/forums/for...ood-estimation but got no response. Therefore i found one command rangestat, and i am thinking that may be my problem will be solved with this command. Initially, i calculated Earnings persistence by using statsby by (year industry) command.I have used different options but it seems that i did some mistakes that's why i am not sure about my expected results.
                        following Francis et al. (2004) and measure PERSIS as
                        the negative of the slope coefficient estimate, φ1,j, from the following model: Earnj ,t = ϕ0,j + ϕ1,j Earnj ,t−1 + vj ,t (2)
                        where Earnj,t = firm j’s net income before extraordinary items in year t
                        i have used these commands using rolling 5 year window (t-4 to t )inclusive and i am interested in Ï•1,j

                        Code:
                         by(code) rangestat (reg)  netprofi_scaled netprofit_lag_scaled, interval(year -4 0 ) by(code)
                        rangestat (reg)  netprofi_scaled netprofit_lag_scaled, interval(year -4 0 ) by(industry12)
                        rangestat (reg)  netprofi_scaled netprofit_lag_scaled, interval(year -4 0 ) by(year industry12)
                        and my previous command
                        Code:
                        regress netprofi_scaled netprofit_lag_scaled 
                        statsby _b e(N), by(year industry12 ) saving(C:\Users\ZULKIFAL KHAN\Desktop\new5.dta, replace) :regress netprofi_scaled netprofit_lag_scaled
                        merge m:1 year industry12 using "C:\Users\ZULKIFAL KHAN\Desktop\new5.dta", keepusing(_b_netprofit_lag_scaled _b_cons _eq2_stat_1) generate(_mergenew5)
                        rename _b_netprofit_lag_scaled Earn_Persistence
                        Code:
                        * Example generated by -dataex-. To install: ssc install dataex
                        clear
                        input long code int year float(netprofi_scaled netprofit_lag_scaled industry12) double(b_netprofit_lag_scaledminfourzer b_netprofit_lag_scaledindstry b_netprofit_lag_scaledbyyrindust) float Earn_Persistence
                        2 2002    .0541609   .05197309 11                   .     .38426529110629926    .38426529110629926    .3842653
                        2 2003   .06027531   .04239774 11                   .      .5753420966532112     .7675521330751163    .7675521
                        2 2004   .06994731   .04337081 11 -1.1098343967738913      .7072153712351431     .9699244388455466    .9699244
                        2 2005   .07639474   .04864008 11  -.5090289631595795      .6589599315623502     .6331158837416777    .6331159
                        2 2006  .065487385   .04066438 11  -.3641086009790797      .7139153734938094    1.2496372721863187   1.2496372
                        2 2007   .07156706  .031068787 11  .13705644498432434      .7903248267975797     .9266520536651194    .9266521
                        2 2008   .04230929   .04848837 11  -.6601181222351329      .8438401085034389    1.1600754682881642   1.1600754
                        2 2009   .05006897   .03612958 11  -.3189213642585713   .0052507213215782535 -.0029225819056142976 -.002922582
                        2 2010   .05004776   .03640516 11 -1.2102445301610985    .001562115965218238    .46027041395371304    .4602704
                        2 2011   .04532459  .034540117 11  -1.196267572144336   .0005941263047039534     .5900324076965229    .5900324
                        2 2012   .04640698  .034368694 11  -.3672712635025519   .0004062432419258185     .5686177512527886   .56861776
                        2 2013   .04265128  .036509234 11   .5976584967941108 -.00046877333782387523     .9956893304476739    .9956893
                        2 2014   .03905883   .03705405 11 -1.4027555101399685      .6534492762554405     .5956541727382755    .5956542
                        2 2015   .04635049  .034451082 11 -2.3279358179822793      .6084149638915894    .32237666058781694    .3223767
                        2 2016   .03932156  .035991646 11  -2.616240671116657      .4734758768684938    .19595089992066694    .1959509
                        2 2017    .0372825  .028406726 11  .36543747057561404     .41710362988976235     .3159563975652928    .3159564
                        4 2002   .03382346           .  3                   .      .6087468798102422     .6087468798102422    .6087469
                        4 2003  .030474726   .03275334  3                   .      .5896385153364951     .5730458450697887   .57304585
                        4 2004 -.014521576   .03380055  3                   .      .6745190476493057     .9801028965211454    .9801029
                        4 2005  -.10038074 -.017738914  3   2.109747239911107      .7000707779908357     .7772917140517917    .7772917
                        4 2008  -.06802762           .  3                   .      .6257185001362517     .4385754738661384    .4385755
                        4 2012   .04015318           .  3                   .      .6833836478505759     .6604038475545955    .6604038
                        4 2013    .0266477   .03592205  3                   .      .7592839844159491     .7544289124499667    .7544289
                        4 2014   .05383832  .019973824  3                   .       .751371231564899     .7165949129576433    .7165949
                        4 2015   .01860939   .04240365  3 -1.5959913589793153      .7910715850066613     .9432592418811036    .9432592
                        4 2016   .12762521   .02203491  3 -3.3629790048046893      .6968254457431783     .5521684590479505    .5521685
                        4 2017   .02392494    .1612647  3  -.3274978489660797       .707486901067454     .6766365799418376    .6766366
                        5 2002  -.05003663  -.03849036 14                   .      .9207606265224055     .9207606265224055    .9207606
                        5 2005  -.10419507           . 14                   .      .6703200295252896     .8819647848438189    .8819648
                        5 2006  .034562558   -.1134682 14                   .      .7998687031856844    1.0495218425935795   1.0495218
                        5 2007   .05183682   .03672581 14                   .       .807275346843351     .9094000527461796       .9094
                        5 2009 -.036126498           . 14                   .      .8762647983596348     .3842677228834368    .3842677
                        5 2010 -.003388216  -.03744588 14  .11245932300070499      .8639878239499996     .7955118108220539    .7955118
                        5 2011  .008937965 -.003465975 14   .7543001974757447      .6577164322015519    .25102977325001596   .25102976
                        5 2012  .017069113 .0088475775 14   .4250104773779567      .6661399700791784     .8964841717619492    .8964842
                        5 2013  -.03376295  .017558604 14  -.2209872787409536      .6626558832464593     .8720896835332748    .8720897
                        5 2014  .033783622  -.03314246 14  -.5111517903442518      .6596765633255757    .49491379275297875    .4949138
                        5 2015 -.030349163  .024244826 14 -1.1323667207312227      .6883180791504886     .9427659176700001    .9427659
                        5 2016   .04954729  -.02288876 14 -1.3093092060908527      .7938852867406223     .7586350182929538     .758635
                        5 2017   .00843338   .04300614 14  -.8040452987057951      .7422952822439255     .6953271917914108    .6953272
                        6 2002  .018708937   .03039697 11                   .     .38426529110629926    .38426529110629926    .3842653
                        6 2003  -.07275046    .0192634 11                   .      .5753420966532112     .7675521330751163    .7675521
                        6 2004  .012209814   -.0770336 11 -.30876025605356894      .7072153712351431     .9699244388455466    .9699244
                        6 2005   .03170938  .014838347 11 -.18009109209248123      .6589599315623502     .6331158837416777    .6331159
                        6 2006   .07874863   .03809309 11   .1535042076447265      .7139153734938094    1.2496372721863187   1.2496372
                        6 2007   .05947759   .05077108 11    .310206676478546      .7903248267975797     .9266520536651194    .9266521
                        6 2008   .02614669   .04393499 11   .3379657674239014      .8438401085034389    1.1600754682881642   1.1600754
                        6 2009    .0508165   .02277052 11    .428332456152809   .0052507213215782535 -.0029225819056142976 -.002922582
                        6 2010   .06268368   .04232525 11 -.04453490986416497    .001562115965218238    .46027041395371304    .4602704
                        6 2011   .05140437   .05878709 11  .06697837122365868   .0005941263047039534     .5900324076965229    .5900324
                        end
                        format %ty year
                        Thes last two columns give the same results, and don't know why?
                        sir could you please guide me how can i solve my problem by using right stata command .
                        sorry for my post maybe it's not so much relevant with this thread, but it's also rangestat command discussion that's why I posted once again my question here.
                        best regard

                        Comment


                        • #13
                          It is not possible that the code you show is what you actually ran. I say this with assurance because the second -rangestat- command will abort execution with the error message that the various reg_* and b_* and se_* variables already exist (having come from the first -rangestat- command). So, clearly there has been additional manipulation of the data beyond what you show. Consequently it is important to see the actual code, unedited, that produced these results.

                          As an aside, I will point out that your third -rangestat- command will not give you a 5 year rolling window. Because you included year in the -by()- option of that command, only observations with year equal to the year of the current observation will be included in your regression.

                          Also, when posting back, please include a larger example of your data. When attempting to run the -rangestat- commands individually on your example, I observed that many of the regressions you seek to calculate fail because there are insufficient observations with nonmissing values of the regressioin variables to sustain a regression. Please be sure your example data includes enough data that all of the -rangestat- commands individually runs on it without producing error messages.

                          Added: I just realized that what I said in my second paragraph "as an aside" is not really an aside: it is a direct answer to your question. The -statsby- command also does not use a rolling 5 year window and simply regresses all the observations matching a given industry and year: which is exactly what the third -rangestat- also does. That is why the last two variables in your example data are the same. Both of them are simply results of regressions grouped by industry and year.
                          Last edited by Clyde Schechter; 10 Aug 2019, 11:37.

                          Comment


                          • #14
                            @Clyde Schechter thank you so much for your positive and timely reply.
                            Yes sir, you are 100% right that i have
                            manipulated the data .i run those command individually, after each one i just renamed the Beta coefficient and dropped the other ones.my purpose was to just compare the Beta values i got through different options and to ease the comparison for the expert.
                            sir with respect to "as an aside", i am also searching for this solution to get rolling 5 year window for my variable of interest which is the coefficient value i.e b_x .
                            following are the questions in my mind about my issue
                            Q 1: sir my main objective is to get the value of b_x for 5-year rolling window, firm and year specific or year and industry-specific.

                            Q2:sir whenever i am running asrol command for rolling window i am using minimum command for years i.e window(year 5) min(5) , and i get the result if there are al least 5 consecutive years data, otherwise giving me missing value, but i am unable to pick that point here in rangestat for this particular case.

                            Q3: is the value b_x we get through rangestat is the average of coefficient x for rolling window of 5 years?

                            Q4:sir i noted here that if reg_nobs=3 then it gives us values, otherwise for reg_nobs=1 or 2 it is missing. actually, i was thinking that i can get results only for those firms who have enough observations(at least 5 years data) otherwise it will give me missing values, but, here they are also giving me result for reg_nobs=3 or reg_nobs=4, although my interval is (t-4 to t).


                            Q5: can i drop if reg_nobs <5 ? for interval (-4 0), i have just perceived it ,if there are 4 previous years and one current year data then reg_nobs=5 for interval(-4 0).

                            my variables are net profit then i take lagg values of net profit. After that, i scaled the previous two variables with average total assets and i got y and x . and then i run the regression.

                            Code:
                            rangestat (reg)  y x , interval(year -4 0 ) by( code)
                            (1)
                            beolow is the reult of (1)
                            Code:
                            * Example generated by -dataex-. To install: ssc install dataex
                            clear
                            input long code int year double netprofit float(netprofit_lag AverageTotalAssetsnew y x industry) double(reg_nobs reg_r2 reg_adj_r2 b_x b_cons se_x se_cons)
                             2 2001  381969284.4           .            .           .           . 11 .                     .                     .                    .                     .                  .                    .
                             2 2002  398048307.6   381969280   7349366784    .0541609   .05197309 11 1                     .                     .                    .                     .                  .                    .
                             2 2003  565890614.8   398048320   9388431360   .06027531   .04239774 11 2                     .                     .                    .                     .                  .                    .
                             2 2004  912653719.7   565890624  13047731200   .06994731   .04337081 11 3     .5399198249106972    .07983964982139447  -1.1098343967738913     .1124179737691291 1.0244960857124839   .04724470193906932
                             2 2005   1433425712   912653696  18763407360   .07639474   .04864008 11 4    .05387035527180736    -.4191944670922889   -.5090289631595795     .0889129882931865 1.5084395174847305    .0705332791177694
                             2 2006   2308440479  1433425664  35250155520  .065487385   .04066438 11 5   .040244951933604216   -.27967339742186104   -.3641086009790797    .08178701631731489  1.026584745592123  .046817772115294996
                             2 2007   5317500818  2308440576  74300956672   .07156706  .031068787 11 5   .020553332971508232   -.30592888937132234   .13705644498432434    .06308374878573542  .5462457898958772  .022737627155070144
                             2 2008   4639869153  5317500928 1.096655e+11   .04230929   .04848837 11 5    .12743173381467054    -.1634243549137726   -.6601181222351329    .09316085064951185  .9972910909647891   .04281821997682846
                             2 2009   6430007539  4639868928  1.28423e+11   .05006897   .03612958 11 5   .028771934373824713    -.2949707541682336   -.3189213642585713    .07424070359284185  1.069791313555271   .04447344491850027
                             2 2010   8839610505  6430007296 1.766235e+11   .05004776   .03640516 11 5      .420971611915335    .22796214922044677  -1.2102445301610985    .10255253718101631  .8194755948314947    .0319504385333813
                             2 2011  11599606212  8839610368  2.55923e+11   .04532459  .034540117 11 5    .47033169860204177     .2937755981360558   -1.196267572144336    .09651589856068821  .7329385582288305  .027697113277951116
                             2 2012  15662588423 11599605760  3.37505e+11   .04640698  .034368694 11 5     .4355843483545753    .24744579780610054   -.3672712635025519   .060782826252629096  .2413735694950462  .009258198319158618
                             2 2013  18297549871 15662588928 4.290035e+11   .04265128  .036509234 11 5   .038541322670946225    -.2819449031054049    .5976584967941108   .025628919664740124 1.7234332801733236  .061359226438163016
                             2 2014  19287524028 18297550848  4.93807e+11   .03905883   .03705405 11 5    .17598802086629226   -.09868263884494355  -1.4027555101399685    .09488210195666369   1.75245374957952   .06272457414893101
                             2 2015  25949438026 19287523328 5.598525e+11   .04635049  .034451082 11 5     .9195960262353524     .8927947016471366  -2.3279358179822793     .1263315973806911 .39742079590131935  .014070077799029442
                             2 2016  28350255481 25949437952  7.20985e+11   .03932156  .035991646 11 5     .7810523108729983     .7080697478306645   -2.616240671116657    .13609206301980947  .7997369968065834  .028543799154326727
                             2 2017  37208387330 28350255104  9.98012e+11    .0372825  .028406726 11 5    .12883896645582454   -.16154804472556727   .36543747057561404   .028331718861194233  .5486281071248793  .018997343889209158
                             4 2002   8212732.31           .            .           .           .  3 .                     .                     .                    .                     .                  .                    .
                             4 2003   7641381.76     8212733    250744880  .030474726   .03275334  3 1                     .                     .                    .                     .                  .                    .
                             4 2004  -3282932.11     7641382    226072704 -.014521576   .03380055  3 2                     .                     .                    .                     .                  .                    .
                             4 2005 -18577413.51    -3282932    185069504  -.10038074 -.017738914  3 3     .8739191345313866     .7478382690627732    2.109747239911107  -.062471617845296354  .8013447460692812  .023270880253207837
                             4 2008 -11484191.49           .            .           .           .  3 2                     .                     .                    .                     .                  .                    .
                             4 2012   7814225.29           .            .           .           .  3 .                     .                     .                    .                     .                  .                    .
                             4 2013   5796749.79     7814226    217532832    .0266477   .03592205  3 1                     .                     .                    .                     .                  .                    .
                             4 2014  15624813.56     5796750    290217344   .05383832  .019973824  3 2                     .                     .                    .                     .                  .                    .
                             4 2015   6857151.71    15624814    368478048   .01860939   .04240365  3 3     .9957648401081749     .9915296802163498  -1.5959913589793153    .08532686553736213 .10408473658490111   .00354877406319993
                             4 2016  39716316.22     6857152    311194912   .12762521   .02203491  3 4     .5398252155581137     .3097378233371706  -3.3629790048046893    .15785069778384903 2.1955532943308387   .06919437018548243
                             4 2017   5892241.41    39716316    246280288   .02392494    .1612647  3 5     .1835429212946906   -.08860943827374568   -.3274978489660797    .06857373412291026 .39879130807636287  .030879561504734906
                             5 2001 -72070581.12           .            .           .           . 14 .                     .                     .                    .                     .                  .                    .
                             5 2002 -93690182.72   -72070584   1872431872  -.05003663  -.03849036 14 1                     .                     .                    .                     .                  .                    .
                             5 2005 -179970049.5           .            .           .           . 14 1                     .                     .                    .                     .                  .                    .
                             5 2006  54819108.11  -179970048   1586083584  .034562558   -.1134682 14 2                     .                     .                    .                     .                  .                    .
                             5 2007  77374688.36    54819108   1492658816   .05183682   .03672581 14 2                     .                     .                    .                     .                  .                    .
                             5 2009 -48919528.98           .            .           .           . 14 2                     .                     .                    .                     .                  .                    .
                             5 2010   -4426387.1   -48919528   1306406272 -.003388216  -.03744588 14 3    .08937436362372211    -.8212512727525558   .11245932300070499   .031950899615680706 .35897063212578145  .025907312273650823
                             5 2011  11414651.25    -4426387   1277097344  .008937965 -.003465975 14 3     .9333895978123696     .8667791956247393    .7543001974757447    .02018136723879705 .20150404614557083   .00611523217254916
                             5 2012  22021617.89    11414651   1290144256  .017069113 .0088475775 14 3     .9788161596270922     .9576323192541845    .4250104773779567   .012082171261014815 .06252467150756978 .0013945881385641714
                             5 2013 -42344755.22    22021618   1254178176  -.03376295  .017558604 14 4    .05723569121601803   -.41414646317597303   -.2209872787409536 -.0035874143675934155  .6341914409149542  .013456187272351379
                             5 2014  43163944.16   -42344756   1277658880  .033783622  -.03314246 14 5    .24940950587235833 -.0007873255035222293   -.5111517903442518  -.000343178591395368  .5119579459395047  .012327907899625746
                             5 2015  -54031716.5    43163944   1780336256 -.030349163  .024244826 14 5     .7346848410683368     .6462464547577824  -1.1323667207312227  .0023159860916170203  .3928773236521595   .00802245753010452
                             5 2016  116962419.9   -54031716   2360622080   .04954729  -.02288876 14 5      .781246848732301      .708329131643068  -1.3093092060908527   .005848709811903499 .40000425755428864  .009115734168994024
                             5 2017  22935991.94   116962416   2719667712   .00843338   .04300614 14 5    .48726939496611016      .316359193288147   -.8040452987057951     .0101582551065021 .47618964039497963   .01407454553680826
                             6 2001  132376039.7           .            .           .           . 11 .                     .                     .                    .                     .                  .                    .
                             6 2002  81475710.88   132376040   4354908672  .018708937   .03039697 11 1                     .                     .                    .                     .                  .                    .
                             6 2003 -307702477.7    81475712   4229560832  -.07275046    .0192634 11 2                     .                     .                    .                     .                  .                    .
                             6 2004  48770794.24  -307702464   3994392832  .012209814   -.0770336 11 3    .12774904273229754    -.7445019145354048  -.30876025605356894   -.01676115727477744  .8067951754975063   .03960487910183208
                             6 2005  104222639.5    48770796   3286807808   .03170938  .014838347 11 4    .03549103046904622    -.4467634542964307  -.18009109209248123  -.003094936588179293  .6638516892145191  .028648501641374346
                             6 2006  215456140.6   104222640   2735998720   .07874863   .03809309 11 5    .01713980417436195    -.3104802611008506    .1535042076447265   .012940602348183181  .6711237416181066  .028315521057148508
                             6 2007  252403755.4   215456144   4243678208   .05947759   .05077108 11 5    .07069037033333374   -.23907950622222174     .310206676478546   .019029289217773245  .6493675818141861  .029834489512320494
                             6 2008  150211068.9   252403760   5744936960   .02614669   .04393499 11 5    .43783406769778144     .2504454235970419    .3379657674239014   .036886079260010286  .2211004221341757   .01088273354395086
                             6 2009  335222969.1   150211072   6596734976    .0508165   .02277052 11 5    .08978464833483431   -.21362046888688746     .428332456152809    .03478149911539541   .787392712962729  .028818450391153824
                             6 2010  496465075.5   335222976   7920164864   .06268368   .04232525 11 5  .0005804824469271938    -.3325593567374303  -.04453490986416497    .05733726338791112  1.066889197147277   .04338710095538717
                             6 2011  434117007.9   496465088   8445137920   .05140437   .05878709 11 5   .003915116905690484    -.3281131774590793   .06697837122365868    .04717761929232844  .6168076650969978  .027959601990972506
                             6 2012    629565380   434116992   8832702464   .07127664   .04914883 11 5    .01261922126135435    -.3165077049848608   .14461253685922415    .04619035544364192  .7385354970247073   .03321232225736652
                             6 2013    698009106   629565376   9655794688   .07228914   .06520078 11 5    .26545700526137495   .020609340348499927    .3245737221154723   .046229266134152125  .3117196958867576  .015543905035224868
                             6 2014  512453559.5   698009088  10860688384   .04718426   .06426932 11 5    .08323455547296738   -.22235392603604343  -.33076372494500816    .07947261058335453  .6337741655705419   .03590166337432852
                             6 2015  438785915.1   512453568  12228361216  .035882644   .04190697 11 5    .14482853569301257   -.14022861907598316    .5975121491218829   .022228830506339836  .8382733187605808   .04743384406344473
                             6 2016  803876525.5   438785920  12936944640   .06213805  .033917274 11 5    .03595550383284521   -.28539266155620635   .21851357138366012    .04663429021066112  .6532563473348904   .03419954009297623
                             6 2017  820482505.6   803876544  13155158016   .06236964   .06110733 11 5    .09660373500562336   -.20452835332583552    .3103622402421671    .03943654339818292  .5479619935572647   .03003548451049345
                             7 2003  15874906.15           .            .           .           . 11 .                     .                     .                    .                     .                  .                    .
                             7 2004 -154384945.6    15874906   1083052288  -.14254616  .014657562 11 1                     .                     .                    .                     .                  .                    .
                             7 2005  10293621.47  -154384944    951354304  .010819966  -.16227913 11 2                     .                     .                    .                     .                  .                    .
                             7 2006 -99644894.79    10293621    830082944   -.1200421  .012400714 11 3      .984414087206019      .968828174412038   -.8094793880032472   -.12040892765362822 .10185515304667361  .009609560483427718
                             7 2011   8310538.62           .            .           .           . 11 .                     .                     .                    .                     .                  .                    .
                             7 2013  18830603.46           .            .           .           . 11 .                     .                     .                    .                     .                  .                    .
                             7 2014 -33382647.02    18830604    669218560  -.04988303    .0281382 11 1                     .                     .                    .                     .                  .                    .
                             7 2015  13238872.22   -33382648    580644864   .02280029  -.05749237 11 2                     .                     .                    .                     .                  .                    .
                             7 2016   81567961.1    13238872    497366112   .16399984   .02661796 11 3   .027753129383539733    -.9444937412329206   .36970692412877043    .04597623344770499  2.188214448140768   .08758004420306441
                             7 2017    795055.38    81567960    478521632 .0016614826   .17045826 11 4    .02231090990115888    -.4665336351482616    -.144492102733269    .04070327474638556  .6763490069159354   .06222931322645233
                             8 2006  -1756059.21           .            .           .           .  3 .                     .                     .                    .                     .                  .                    .
                             8 2009    313488.74           .            .           .           .  3 .                     .                     .                    .                     .                  .                    .
                             8 2010    888948.26   313488.75     78670096  .011299697 .0039848527  3 1                     .                     .                    .                     .                  .                    .
                             8 2011   -539451.82    888948.3     77584408 -.006953096   .01145782  3 2                     .                     .                    .                     .                  .                    .
                             8 2012  39129030.59   -539451.8    345533120    .1132425 -.001561216  3 3     .7969314083616971     .5938628167233941   -8.850527216280694    .08014910254262032  4.467659319070256  .031548771531129005
                             8 2014   7766402.64           .            .           .           .  3 3     .7969314083616971     .5938628167233941   -8.850527216280694    .08014910254262032  4.467659319070256  .031548771531129005
                             8 2015  189909159.6     7766403   2131691392   .08908848  .003643305  3 3     .9535379156414671     .9070758312829341   -9.474359255747666     .1078866167623522 2.0913668018458034  .014639204977523976
                             8 2016  530541641.4   189909152   5891005440    .0900596   .03223714  3 3     .3485857947507366    -.3028284104985268   -.4436210228269024    .10253843864466963   .606437276520832  .011372082463707764
                             8 2017  889609890.1   530541632   9435486208   .09428342   .05622833  3 3     .8502358835141434     .7004717670282867   .09673936022995644    .08817365534088215 .04060106076012648 .0015217061826517833
                             9 2001  57351903.87           .            .           .           . 18 .                     .                     .                    .                     .                  .                    .
                             9 2002  34602901.47    57351904   4078321664  .008484594  .014062624 18 1                     .                     .                    .                     .                  .                    .
                             9 2003  37643922.98    34602900   4185824256  .008993193  .008266687 18 2                     .                     .                    .                     .                  .                    .
                             9 2004  54746272.43    37643924   4615543296  .011861284  .008155903 18 3     .3955118312059116    -.2089763375881768   -.3388697354580099    .01322319568699254  .4189352907641804  .004411200142718059
                             9 2005  113998063.2    54746272   4929001984   .02312802   .01110697 18 4  .0009037727629092353   -.49864434085563625   .07344317542241186   .012353107477417802   1.72667453155742  .018435415274841604
                             9 2006  156697013.8   113998064   5199575040  .030136503  .021924496 18 5     .5214317573242895     .3619090097657194   1.2225064032892679  .0009908096315105058  .6761821689730826  .009254869288195838
                             9 2007  331561474.2   156697008   5675161088   .05842327  .027611025 18 5     .8853912966183517     .8471883954911357     2.10210400055733  -.005891308139267193  .4366512891496382  .007566232818814324
                             9 2008  271544919.2   331561472   5961544704   .04554942   .05561671 18 5     .4694125356270326     .2925500475027103    .6663517718815495   .017238855926624344  .4090195631026266  .012306193227932118
                             9 2009  408594409.4   271544928   6.7929e+09   .06015022   .03997482 18 5     .3539178765969646     .1385571687959528    .5748191913700032   .025516225449029872  .4483975639740382  .015607354666543673
                             9 2010  441594065.9   408594400   8763328512   .05039113   .04662548 18 5    .07263304781804496   -.23648926957593996   .23687576796604048    .03984580462312182 .48867337943670974  .019678667495620982
                             9 2011  380435408.3   441594080  10905138176  .034885887   .04049413 18 5     .1780537317730624   -.09592835763591667  -.42301865866344457    .06767402641804621  .5247410866389924  .022591042736397025
                             9 2012  307301126.7   380435424  12478479360   .02462649  .030487323 18 5     .2543863689061111   .005848491874814843    .7493465519430487   .011168724465342228   .740682506066675   .03217392324994204
                             9 2013  444151234.2   307301120  13391565824   .03316649  .022947364 18 5       .40535960613621     .2071461415149467    .9757507199198336    .00541376113016967  .6823154763359058   .02528759923648182
                             9 2014  472548632.6   444151232  14168648704   .03335171  .031347465 18 5     .5385718273952451     .3847624365269935    .7421818430441647   .009767868394887413 .39662486350444504   .01402553431076933
                             9 2015  965898398.9   472548640  16419714048   .05882553  .028779346 18 5   .010039456877364267   -.31994739083018087  -.20372203702029168   .043248125978575525  1.167968731135166  .036588369392201815
                             9 2016  419482105.1   965898368  19868430336  .021112997   .04861473 18 5    .23011492324897478  -.026513435668033658   -.7359194060928527    .05808636931253647  .7771595473705732  .026079150691457567
                             9 2017  323247414.7   419482112  24366194688  .013266224  .017215742 18 5 8.385822226125547e-06   -.33332215223703177 -.004215030816730803    .03207011759607625  .8403602084752828   .02656726593810077
                            10 2002  32846171.18           .            .           .           .  5 .                     .                     .                    .                     .                  .                    .
                            10 2003  37695750.95    32846172    758362816   .04970675   .04331195  5 1                     .                     .                    .                     .                  .                    .
                            10 2004  10283122.91    37695752    864462208    .0118954   .04360602  5 2                     .                     .                    .                     .                  .                    .
                            10 2005  -82664107.2    10283123    607797632  -.13600597  .016918663  5 3     .9591805942580384     .9183611885160767    6.272625903032159   -.24191071725417101 1.2939948093468527   .04762446391759211
                            10 2008  18345826.75           .            .           .           .  5 2                     .                     .                    .                     .                  .                    .
                            end
                            format %ty year

                            continued :..........

                            Comment


                            • #15
                              part 2: continued part of thread # 14

                              sir after that i re-run these commands for industry wise, i just droped the previous rangestat values so that i can solve the problem "reg_nobs already defined
                              r(110)
                              "

                              Code:
                              rangestat (reg)  y x , interval(year -4 0 ) by( industry)
                              .....(2)

                              below are the results of (2):
                              Code:
                               dataex code year netprofit netprofit_lag AverageTotalAssetsnew y x industry reg_nobs reg_r2 reg_adj_r2 b_x b_cons se_x se_cons  in 1/200
                              Code:
                              * Example generated by -dataex-. To install: ssc install dataex
                              clear
                              input long code int year double netprofit float(netprofit_lag AverageTotalAssetsnew y x industry) double(reg_nobs reg_r2 reg_adj_r2 b_x b_cons se_x se_cons)
                               2 2001  381969284.4           .            .           .           . 11    .                      .                     .                      .                      .                    .                    .
                               2 2002  398048307.6   381969280   7349366784    .0541609   .05197309 11   85     .12617067778943772    .11564261366641893     .38426529110629926    .012927195336173609   .11100082358476122  .004990668031280036
                               2 2003  565890614.8   398048320   9388431360   .06027531   .04239774 11  179      .1619508948795433      .157216154172648      .5753420966532112    .006020517905370764   .09837450855061469  .004194109994759631
                               2 2004  912653719.7   565890624  13047731200   .06994731   .04337081 11  271      .1453500700146297     .1421729327284389      .7072153712351431    -.00241745610582526   .10455915371606345  .004307871078505174
                               2 2005   1433425712   912653696  18763407360   .07639474   .04864008 11  361      .2274551032669514    .22530316762145552      .6589599315623502  -.0007288592273420377   .06409524396938403 .0032702987573992163
                               2 2006   2308440479  1433425664  35250155520  .065487385   .04066438 11  443     .25017773952912226    .24847746229449452      .7139153734938094 -.00038690650391332015   .05885485202269202  .002877615106149719
                               2 2007   5317500818  2308440576  74300956672   .07156706  .031068787 11  437     .27159279877494685     .2699182994617859      .7903248267975797   .0019469813234324444   .06205674417001671  .003020819852956209
                               2 2008   4639869153  5317500928 1.096655e+11   .04230929   .04848837 11  426      .2758691812199802    .27416132551531047      .8438401085034389   .0007712835704306587    .0663948139647815 .0034219198455933543
                               2 2009   6430007539  4639868928  1.28423e+11   .05006897   .03612958 11  421   .0015813632575243292 -.0008014974506915795   .0052507213215782535    .028567860864998365  .006445438592690918  .003285706847991714
                               2 2010   8839610505  6430007296 1.766235e+11   .05004776   .03640516 11  424  .00017988981985209957 -.0021893521473994593    .001562115965218238     .03756201654352928   .00566910741728321 .0028761761107656595
                               2 2011  11599606212  8839610368  2.55923e+11   .04532459  .034540117 11  439 .000029239563382337336  -.002259023046312647   .0005941263047039534    .040302387733405214  .005255890050532085 .0026216415041268233
                               2 2012  15662588423 11599605760  3.37505e+11   .04640698  .034368694 11  463 .000015614454094947272 -.0021535490720350214   .0004062432419258185     .03801068585447521  .004788162636044822  .002326118270130355
                               2 2013  18297549871 15662588928 4.290035e+11   .04265128  .036509234 11  488  .00004055307466565947  -.002016976651518121 -.00046877333782387523     .03869818342586865 .0033390588092191407 .0015793514541997205
                               2 2014  19287524028 18297550848  4.93807e+11   .03905883   .03705405 11  516      .2575511545001868     .2561067014933778      .6534492762554405     .01184049656263153   .04893637994857755  .002110851749775588
                               2 2015  25949438026 19287523328 5.598525e+11   .04635049  .034451082 11  538     .23630772756157972    .23488292854583637      .6084149638915894     .01012680801970537   .04724302829135135 .0019237336287833034
                               2 2016  28350255481 25949437952  7.20985e+11   .03932156  .035991646 11  558     .15254471654737958    .15102051639728498      .4734758768684938    .015149443448889157   .04732823098841177 .0018168782221251168
                               2 2017  37208387330 28350255104  9.98012e+11    .0372825  .028406726 11  572     .12412114221419045    .12258451263912762     .41710362988976235     .01674589917150022   .04640937090516218 .0017792143006140017
                               4 2002   8212732.31           .            .           .           .  3  473      .2578247061422014     .2562489624185118      .6087468798102422    .004856594072378546   .04759017211574937 .0030097433339255036
                               4 2003   7641381.76     8212733    250744880  .030474726   .03275334  3  968     .25575345287509893     .2549830113149283      .5896385153364951    .012122213322101952   .03236271451421591 .0019507145760564533
                               4 2004  -3282932.11     7641382    226072704 -.014521576   .03380055  3 1494      .2787721085432047      .278288711833113      .6745190476493057    .009650976775739104  .028088037957996043 .0016037207602502808
                               4 2005 -18577413.51    -3282932    185069504  -.10038074 -.017738914  3 2069      .2906390948649324     .2902959110695116      .7000707779908357    .007414284651055723   .02405627170292092 .0013803201376538432
                               4 2008 -11484191.49           .            .           .           .  3 2969      .2443599815988144     .2441053000961515      .6257185001362517    .015504198781918867  .020200524948235307  .001294929274522975
                               4 2012   7814225.29           .            .           .           .  3 4523     .32384235759928326      .323692798288865      .6833836478505759     .01680843479424053  .014686032449200625 .0010538077038017976
                               4 2013   5796749.79     7814226    217532832    .0266477   .03592205  3 5159     .38861336717692946     .3884948124682184      .7592839844159491    .014930269792304746  .013261870286776372 .0009048486095087181
                               4 2014  15624813.56     5796750    290217344   .05383832  .019973824  3 5809      .4211506054148992     .4210509241001782       .751371231564899     .01461844817249465   .01155959788391361 .0007813093615210257
                               4 2015   6857151.71    15624814    368478048   .01860939   .04240365  3 6449      .4181710659909196     .4180808179788196      .7910715850066613    .009635268609867742  .011621377731784784  .000764944911748951
                               4 2016  39716316.22     6857152    311194912   .12762521   .02203491  3 6961     .37992075394504765    .37983164929695823      .6968254457431783    .014802135287515832   .01067155413272906 .0006996663199998825
                               4 2017   5892241.41    39716316    246280288   .02392494    .1612647  3 7519      .3780452896589547    .37796254990767875       .707486901067454     .01751739208796293  .010466550984547756 .0006658292552533246
                               5 2001 -72070581.12           .            .           .           . 14    .                      .                     .                      .                      .                    .                    .
                               5 2002 -93690182.72   -72070584   1872431872  -.05003663  -.03849036 14   11      .9666660275913999     .9629622528793331      .9207606265224055  -.0022009018591368536   .05699421715973909 .0038503483480528287
                               5 2005 -179970049.5           .            .           .           . 14   45     .33786921212101334      .322470821705223      .6703200295252896   .0010082435833510886   .14310194952668034  .008100053132381829
                               5 2006  54819108.11  -179970048   1586083584  .034562558   -.1134682 14   58      .4277558693606767    .41753722417068884      .7998687031856844  -.0007750649687194577   .12362815147202502  .007424554658248561
                               5 2007  77374688.36    54819108   1492658816   .05183682   .03672581 14   60      .3856261803266996     .3750335282633669       .807275346843351    .004733130871988584    .1337952785893599  .007755893101345046
                               5 2009 -48919528.98           .            .           .           . 14   68      .5280868978673403     .5209366993501788      .8762647983596348    .003919190753520492   .10196279198168343  .005998105235708883
                               5 2010   -4426387.1   -48919528   1306406272 -.003388216  -.03744588 14   71      .5227212163843501     .5158041325638334      .8639878239499996     .00818465730366836   .09938802886041975  .005369743288323829
                               5 2011  11414651.25    -4426387   1277097344  .008937965 -.003465975 14   79      .2014163827775282    .19104516696944418      .6577164322015519     .02543769090396162    .1492471792664968  .007277831119692494
                               5 2012  22021617.89    11414651   1290144256  .017069113 .0088475775 14   92     .22457263475696648    .21595677514315503      .6661399700791784    .023557614202422278   .13047772718510137  .006944202475480411
                               5 2013 -42344755.22    22021618   1254178176  -.03376295  .017558604 14  105      .2490611805853906    .24177051243573422      .6626558832464593     .02631383099350254   .11337536607168915  .006205377824921558
                               5 2014  43163944.16   -42344756   1277658880  .033783622  -.03314246 14  119     .21895330267133636    .21227768987365558      .6596765633255757    .026103223438567802   .11518631216459173  .006371414598195734
                               5 2015  -54031716.5    43163944   1780336256 -.030349163  .024244826 14  136      .2323612193418592     .2266325717250074      .6883180791504886    .025419409252130515     .108077031499014 .0059851619082781984
                               5 2016  116962419.9   -54031716   2360622080   .04954729  -.02288876 14  152     .44645428927087366     .4427639845326795      .7938852867406223    .015177308732223643   .07217725623810611  .003970984299640815
                               5 2017  22935991.94   116962416   2719667712   .00843338   .04300614 14  165     .41621563949836854    .41263414035418666      .7422952822439255     .01832301050735874   .06885729038417832 .0034757901788237426
                               6 2001  132376039.7           .            .           .           . 11    .                      .                     .                      .                      .                    .                    .
                               6 2002  81475710.88   132376040   4354908672  .018708937   .03039697 11   85     .12617067778943772    .11564261366641893     .38426529110629926    .012927195336173609   .11100082358476122  .004990668031280036
                               6 2003 -307702477.7    81475712   4229560832  -.07275046    .0192634 11  179      .1619508948795433      .157216154172648      .5753420966532112    .006020517905370764   .09837450855061469  .004194109994759631
                               6 2004  48770794.24  -307702464   3994392832  .012209814   -.0770336 11  271      .1453500700146297     .1421729327284389      .7072153712351431    -.00241745610582526   .10455915371606345  .004307871078505174
                               6 2005  104222639.5    48770796   3286807808   .03170938  .014838347 11  361      .2274551032669514    .22530316762145552      .6589599315623502  -.0007288592273420377   .06409524396938403 .0032702987573992163
                               6 2006  215456140.6   104222640   2735998720   .07874863   .03809309 11  443     .25017773952912226    .24847746229449452      .7139153734938094 -.00038690650391332015   .05885485202269202  .002877615106149719
                               6 2007  252403755.4   215456144   4243678208   .05947759   .05077108 11  437     .27159279877494685     .2699182994617859      .7903248267975797   .0019469813234324444   .06205674417001671  .003020819852956209
                               6 2008  150211068.9   252403760   5744936960   .02614669   .04393499 11  426      .2758691812199802    .27416132551531047      .8438401085034389   .0007712835704306587    .0663948139647815 .0034219198455933543
                               6 2009  335222969.1   150211072   6596734976    .0508165   .02277052 11  421   .0015813632575243292 -.0008014974506915795   .0052507213215782535    .028567860864998365  .006445438592690918  .003285706847991714
                               6 2010  496465075.5   335222976   7920164864   .06268368   .04232525 11  424  .00017988981985209957 -.0021893521473994593    .001562115965218238     .03756201654352928   .00566910741728321 .0028761761107656595
                               6 2011  434117007.9   496465088   8445137920   .05140437   .05878709 11  439 .000029239563382337336  -.002259023046312647   .0005941263047039534    .040302387733405214  .005255890050532085 .0026216415041268233
                               6 2012    629565380   434116992   8832702464   .07127664   .04914883 11  463 .000015614454094947272 -.0021535490720350214   .0004062432419258185     .03801068585447521  .004788162636044822  .002326118270130355
                               6 2013    698009106   629565376   9655794688   .07228914   .06520078 11  488  .00004055307466565947  -.002016976651518121 -.00046877333782387523     .03869818342586865 .0033390588092191407 .0015793514541997205
                               6 2014  512453559.5   698009088  10860688384   .04718426   .06426932 11  516      .2575511545001868     .2561067014933778      .6534492762554405     .01184049656263153   .04893637994857755  .002110851749775588
                               6 2015  438785915.1   512453568  12228361216  .035882644   .04190697 11  538     .23630772756157972    .23488292854583637      .6084149638915894     .01012680801970537   .04724302829135135 .0019237336287833034
                               6 2016  803876525.5   438785920  12936944640   .06213805  .033917274 11  558     .15254471654737958    .15102051639728498      .4734758768684938    .015149443448889157   .04732823098841177 .0018168782221251168
                               6 2017  820482505.6   803876544  13155158016   .06236964   .06110733 11  572     .12412114221419045    .12258451263912762     .41710362988976235     .01674589917150022   .04640937090516218 .0017792143006140017
                               7 2003  15874906.15           .            .           .           . 11  179      .1619508948795433      .157216154172648      .5753420966532112    .006020517905370764   .09837450855061469  .004194109994759631
                               7 2004 -154384945.6    15874906   1083052288  -.14254616  .014657562 11  271      .1453500700146297     .1421729327284389      .7072153712351431    -.00241745610582526   .10455915371606345  .004307871078505174
                               7 2005  10293621.47  -154384944    951354304  .010819966  -.16227913 11  361      .2274551032669514    .22530316762145552      .6589599315623502  -.0007288592273420377   .06409524396938403 .0032702987573992163
                               7 2006 -99644894.79    10293621    830082944   -.1200421  .012400714 11  443     .25017773952912226    .24847746229449452      .7139153734938094 -.00038690650391332015   .05885485202269202  .002877615106149719
                               7 2011   8310538.62           .            .           .           . 11  439 .000029239563382337336  -.002259023046312647   .0005941263047039534    .040302387733405214  .005255890050532085 .0026216415041268233
                               7 2013  18830603.46           .            .           .           . 11  488  .00004055307466565947  -.002016976651518121 -.00046877333782387523     .03869818342586865 .0033390588092191407 .0015793514541997205
                               7 2014 -33382647.02    18830604    669218560  -.04988303    .0281382 11  516      .2575511545001868     .2561067014933778      .6534492762554405     .01184049656263153   .04893637994857755  .002110851749775588
                               7 2015  13238872.22   -33382648    580644864   .02280029  -.05749237 11  538     .23630772756157972    .23488292854583637      .6084149638915894     .01012680801970537   .04724302829135135 .0019237336287833034
                               7 2016   81567961.1    13238872    497366112   .16399984   .02661796 11  558     .15254471654737958    .15102051639728498      .4734758768684938    .015149443448889157   .04732823098841177 .0018168782221251168
                               7 2017    795055.38    81567960    478521632 .0016614826   .17045826 11  572     .12412114221419045    .12258451263912762     .41710362988976235     .01674589917150022   .04640937090516218 .0017792143006140017
                               8 2006  -1756059.21           .            .           .           .  3 2642      .2901962487907975     .2899273837335211      .6486978147161835    .011949492391955873   .01974529922182112  .001166407312500806
                               8 2009    313488.74           .            .           .           .  3 3155      .2514281783238996    .25119076258597506      .6293566645871112      .0178988731403237   .01933947201502325 .0012997259520227226
                               8 2010    888948.26   313488.75     78670096  .011299697 .0039848527  3 3398      .2814262791550102    .28121468500870717      .6410473937029093    .023395443104443178  .017577602491154157 .0012083722160122015
                               8 2011   -539451.82    888948.3     77584408 -.006953096   .01145782  3 3895     .31180028541096594    .31162350665047567      .7223299116141918      .0197900882726441   .01719936398195497  .001179880541441767
                               8 2012  39129030.59   -539451.8    345533120    .1132425 -.001561216  3 4523     .32384235759928326      .323692798288865      .6833836478505759     .01680843479424053  .014686032449200625 .0010538077038017976
                               8 2014   7766402.64           .            .           .           .  3 5809      .4211506054148992     .4210509241001782       .751371231564899     .01461844817249465   .01155959788391361 .0007813093615210257
                               8 2015  189909159.6     7766403   2131691392   .08908848  .003643305  3 6449      .4181710659909196     .4180808179788196      .7910715850066613    .009635268609867742  .011621377731784784  .000764944911748951
                               8 2016  530541641.4   189909152   5891005440    .0900596   .03223714  3 6961     .37992075394504765    .37983164929695823      .6968254457431783    .014802135287515832   .01067155413272906 .0006996663199998825
                               8 2017  889609890.1   530541632   9435486208   .09428342   .05622833  3 7519      .3780452896589547    .37796254990767875       .707486901067454     .01751739208796293  .010466550984547756 .0006658292552533246
                               9 2001  57351903.87           .            .           .           . 18    .                      .                     .                      .                      .                    .                    .
                               9 2002  34602901.47    57351904   4078321664  .008484594  .014062624 18   18      .3910182711904628    .35295691313986677      1.320388811263303   -.026019523973558903   .41195089427266496  .017965136013261156
                               9 2003  37643922.98    34602900   4185824256  .008993193  .008266687 18   35     .33061839164657925     .3103341004843544      .9114519727966335  -.0018054449661445288   .22576166677179912  .009528648305628298
                               9 2004  54746272.43    37643924   4615543296  .011861284  .008155903 18   52      .2785819479287049    .26415358688727897      .7885083438384323    .002545844802002345   .17944787031264484  .007270834785615151
                               9 2005  113998063.2    54746272   4929001984   .02312802   .01110697 18   71      .2765662261004626     .2660816786526432      .8688968205485885  -.0010517174117764747   .16917784204894795  .006579784726636297
                               9 2006  156697013.8   113998064   5199575040  .030136503  .021924496 18   92      .2048965189254692    .19606203580241888      .6058813184088495    .008898496948779231   .12580874916533838  .005017816248717473
                               9 2007  331561474.2   156697008   5675161088   .05842327  .027611025 18   95     .19361776068964542    .18494698392286746      .6585511021482456    .010738039246069041   .13936248672009507 .0052039918853570375
                               9 2008  271544919.2   331561472   5961544704   .04554942   .05561671 18   98      .1918196440091103    .18340109863420517      .6595466701610894    .009340086817778634    .1381711970884928  .005417816859335094
                               9 2009  408594409.4   271544928   6.7929e+09   .06015022   .03997482 18  100     .19617599780630152     .1879737120696312      .6345559406776954    .010034790035851386   .12975210922609953 .0052963765540920684
                               9 2010  441594065.9   408594400   8763328512   .05039113   .04662548 18   99     .12598475985106447    .11697429345777655      .5382897529974239    .019825498526465687   .14395632192667468  .005887700053860748
                               9 2011  380435408.3   441594080  10905138176  .034885887   .04049413 18   97     .19854334412067084    .19010695826930946      .7296575067077691     .01612195535005189    .1504075392093397  .006762708113562746
                               9 2012  307301126.7   380435424  12478479360   .02462649  .030487323 18   95     .17259414345028667    .16369730628308543      .5190708013016664    .020294499822606477   .11785049018158464  .006114764219411652
                               9 2013  444151234.2   307301120  13391565824   .03316649  .022947364 18   94      .1552656272733117    .14608373191758683      .5247612273446922     .02151011970769883   .12761162749976432   .00646875543836974
                               9 2014  472548632.6   444151232  14168648704   .03335171  .031347465 18   94      .1529029708461271    .14369539444228063     .45848798063772567    .024543483977938603    .1125103974446419  .006107496015926882
                               9 2015  965898398.9   472548640  16419714048   .05882553  .028779346 18   96     .21275736053859862    .20438243884220064      .6303152331367591   .0061876033224466595   .12505638883991343 .0067699254280747636
                               9 2016  419482105.1   965898368  19868430336  .021112997   .04861473 18   96     .16728888378521548     .1584302548893134       .544773272989981    .005044154380882949   .12536188253840738  .006011015050966151
                               9 2017  323247414.7   419482112  24366194688  .013266224  .017215742 18   96     .13950592406235787     .1303517317651488       .554699123966904    .006212546212528612     .142092504954813 .0057171457176420915
                              10 2002  32846171.18           .            .           .           .  5   16      .8836380140149619     .8753264435874592      1.213134720273359   -.008293848119831205   .11765581097744082 .0036918098172515727
                              10 2003  37695750.95    32846172    758362816   .04970675   .04331195  5   34      .6862381313272095     .6764330729311847     1.2708272190745782   -.009978254194149959   .15190573740885085 .0042921976230077714
                              10 2004  10283122.91    37695752    864462208    .0118954   .04360602  5   56      .3322192887423772     .3198529792746434      .8753978190047611  -.0032766842157821684   .16889356135121986  .005025319293001488
                              10 2005  -82664107.2    10283123    607797632  -.13600597  .016918663  5   82      .4932532821056485    .48691894813196923      .9892199871969369  -.0068375958873870425   .11210071164118858  .004002296472295277
                              10 2008  18345826.75           .            .           .           .  5  136     .39054235568853907     .3859941643130804      .9216037143660045   -.002371369725663425   .09945566161730687 .0034948333356730247
                              end
                              format %ty year

                              sir i hope the questions will be clear now , and i may get suggestions now.
                              best regards sir
                              Last edited by Ayub UOM; 12 Aug 2019, 00:09.

                              Comment

                              Working...
                              X