i use stata 16.0 and have a panel dataset with monthly average temperature (tavg) from 1971-2019 for 48 states.
My goal is to create a table that ranks the states by its median average temperature over the period from 2000-2019 per quarter. The table should show the rank, the state, the median and mean average temperature of the rank of a quarter (for example quarter==2)
Array
I already created a median of tavg by statecode and quarter as well as a rank variable
- bysort statecode quarter: egen mediantavg = median(tavg) if yearly>=2000 & yearly<=2019
- bysort yearly statecode: egen rank= rank(mediantavg) if yearly>=2000 & yearly<=2019 & quarter==2, unique
tab rank
Array
Soruce: Temperature and growth: A panel analysis of the United States, Colacito, Hoffmann & Phan Journal ofMoney, Credit and Banking, Vol. 51, Nos. 2–3 (March–April 2019)
Thank you very much for your help.
Greets, Lea
0 Response to Panel Data: Table with ranks of medians over groups
Post a Comment