I'm trying to count the min and max number of plants constructed each year by the vendors. My data is arranged as below with each observation representing one owner.
. dataex company_code owner_name fiscal_year3 in 1/10
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str4 company_code str58 owner_name float fiscal_year3 "BBI" "Kedar Nath Regmi" 1994 "BBI" "Shiva Narayan Shrestha" 1994 "MTR" "Tikaram Sapkota" 1994 "BBI" "DADHI RAM KANDEL" 1994 "BBI" "Devaka Adhikari" 1994 "ABU" "Tikaram Poudel" 1994 "BBI" "BISHNU PD. SHARMA" 1994 "BBI" "NARAYAN DATTA SAPKOTA" 1994 "BBI" "KEDAR SHARMA" 1994 "BBI" "CHAKRAPANI KANDEL" 1994 end
I want to arrange the data as below with the
fiscal_year number of companies min plants max plants
1994 19 ? ?
I used the code below to get the number of companies, but could not get my head around getting the minimum and maximum number of plants installed by any vendor each year.
preserve
keep compcode fiscal_year3
drop if missing(compcode)
duplicates drop
collapse (count) compcode, by(fiscal_year3)
tabdisp fiscal_year3, c(compcode)
restore
Thank you.
0 Response to Counting the min and max in a panel level data
Post a Comment