Announcement

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

  • weighted average

    Dear all,

    I am going to aggregate data in this way: " weighted average across firms in the same region"

    year: 2010-2020
    region: 7 regions
    firms ID: NPC_FIC
    Dependent variable: real_capital
    independent variable: immigrant share --immi_sh

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(year NPC_FIC) float(region real_capital immi_sh)
    2013 500008310 2         .  .01502585
    2014 500008310 2         . .014562898
    2015 500008310 2         . .014165096
    2010 500027353 5  64986.34 .005582719
    2011 500027353 5   78008.2 .005496878
    2012 500027353 5  71264.33 .005350994
    2013 500027353 5  85624.41 .005218755
    2014 500027353 5  58785.75 .005312667
    2015 500027353 5  66517.86  .00543016
    2016 500027353 5  55918.61 .006016228
    2017 500027353 5  61826.57 .007119962
    2018 500027353 5  68410.24 .008995659
    2010 500049799 4 292976.53 .010180468
    2012 500049799 4  358266.1  .00948444
    2013 500049799 4  331020.5 .009201703
    2014 500049799 4  343133.3 .009351864
    2015 500049799 4 246162.83 .009317032
    2017 500049799 4  254308.2 .010892454
    2018 500049799 4  337233.3 .013140336
    2010 500050215 5  22861.95 .005582719
    2011 500050215 5  25036.45 .005496878
    2010 500135017 1 183422.64  .01941856
    2011 500135017 1  159377.2  .01834199
    2012 500135017 1 77323.195 .017490897
    2013 500135017 1 77490.664 .015756462
    2014 500135017 1  75720.71 .015218307
    2015 500135017 1   72786.1 .014792806
    2016 500135017 1  60485.15  .01514023
    2017 500135017 1  77786.77  .01639583
    2018 500135017 1 213683.75  .02028256
    2019 500135017 1 264940.44  .02746473
    2020 500135017 1 186771.25  .03218416
    2010 500139105 3  63067.09 .024500117
    2011 500139105 3   63033.7 .024015047
    2012 500139105 3  63645.02  .02352138
    2013 500139105 3  53374.98 .022721026
    2014 500139105 3  46920.72  .02314777
    2010 500205042 3 70456.055 .024500117
    2011 500205042 3  81527.36 .024015047
    2013 500205042 3  77518.76 .022721026
    2016 500205042 3  60507.08    .024168
    2017 500205042 3   77808.7  .02649605
    2018 500205042 3  84237.31  .03227291
    2010 500206942 1 166349.77  .01941856
    2011 500206942 1 151644.89  .01834199
    2012 500206942 1 102308.95 .017490897
    2013 500206942 1  93773.03 .015756462
    2014 500206942 1  88694.69 .015218307
    2015 500206942 1  64319.46 .014792806
    2016 500206942 1  61460.93  .01514023
    2017 500206942 1  64405.23  .01639583
    2018 500206942 1  63598.22  .02028256
    2019 500206942 1  61540.16  .02746473
    2010 500251226 1 165027.47  .01941856
    2011 500251226 1    159922  .01834199
    2012 500251226 1 176560.14 .017490897
    2013 500251226 1 164632.47 .015756462
    2014 500251226 1  159354.7 .015218307
    2015 500251226 1 155913.84 .014792806
    2016 500251226 1 160742.06  .01514023
    2017 500251226 1  161747.4  .01639583
    2018 500251226 1  160636.8  .02028256
    2019 500251226 1  180942.8  .02746473
    2020 500251226 1  193027.6  .03218416
    2010 500265754 2  34843.97 .018429495
    2011 500265754 2 38177.918 .017392598
    2012 500265754 2   49234.3  .01658018
    2013 500265754 2  39813.73  .01502585
    2014 500265754 2   43140.6 .014562898
    2010 500321035 1 123004.31  .01941856
    2011 500321035 1 113606.34  .01834199
    2012 500321035 1 126068.15 .017490897
    2013 500321035 1 117805.63 .015756462
    2014 500321035 1 117284.52 .015218307
    2015 500321035 1 101571.95 .014792806
    2016 500321035 1  62455.53  .01514023
    2018 500321035 1 117733.34  .02028256
    2019 500321035 1  77903.49  .02746473
    2010 500369375 4  436237.9 .010180468
    2011 500369375 4    502357  .00982525
    2012 500369375 4  417462.6  .00948444
    2010 500392001 5  39468.33 .005582719
    2013 500392001 5         . .005218755
    2014 500392001 5         . .005312667
    2015 500392001 5         .  .00543016
    2016 500392001 5         . .006016228
    2010 500422489 2 110540.13 .018429495
    2017 500422489 2         .  .01561381
    2018 500422489 2         . .019240983
    2019 500422489 2         .  .02596142
    2010 500458395 1  99531.83  .01941856
    2010 500508011 5  50346.18 .005582719
    2013 500979142 1         . .015756462
    2014 500979142 1         . .015218307
    2015 500979142 1         . .014792806
    2016 500979142 1         .  .01514023
    2018 500979142 1         .  .02028256
    2019 500979142 1         .  .02746473
    2020 500979142 1         .  .03218416
    2010 500979162 1 1302546.8  .01941856
    end
    Any ideas appreciated.
    Cheers,
    Paris
Working...
X