I am trying to create a variable that counts the number of times a particular county (denoted by FIPS and County Name) received funding over a five year period. I've included a data example for review:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long(fips county) int year double empgfunds 1049 305 2014 0 1049 305 2015 0 1049 305 2016 0 1049 305 2017 77426 1049 305 2018 50000 1049 305 2019 50000 1049 305 2020 50000 2068 314 2014 8533.3 2068 314 2015 9289.25 2068 314 2016 0 2068 314 2017 10054.93 2068 314 2018 12000 2068 314 2019 12000 2068 314 2020 12000 2090 368 2014 142000 2090 368 2015 139133.45 2090 368 2016 0 2090 368 2017 175000 2090 368 2018 160000 2090 368 2019 160000 2090 368 2020 160000 2110 559 2014 110000 2110 559 2015 160000 2110 559 2016 0 2110 559 2017 160000 2110 559 2018 160000 2110 559 2019 154081.93 2110 559 2020 160000 2122 570 2014 142000 2122 570 2015 160000 end label values county county label def county 305 "DeKalb", modify label def county 314 "Denali Borough", modify label def county 368 "Fairbanks North Star Borough", modify label def county 559 "Juneau City Borough", modify label def county 570 "Kenai Peninsula Borough", modify
Code:
egen count_empg= count(empgfunds), by fips
0 Response to Using EGEN to Create Count Variable
Post a Comment