Hi Statalist.
I'd like to calculate total research grant income between 2001 to 2023 for each investigator in my dataset - with particular interest in identifying the top grant income earners. Investigator names lie within two columns of data "lead investigator" and "other investigator" - while the former includes a single name, the latter includes the names of multiple investigators. A sample of my data follows:
I attempted
however, this does not do what I want. Appreciate some guidance on approach/code.
Sincerely, Chris.
(Running Stata SE 17.0.)
I'd like to calculate total research grant income between 2001 to 2023 for each investigator in my dataset - with particular interest in identifying the top grant income earners. Investigator names lie within two columns of data "lead investigator" and "other investigator" - while the former includes a single name, the latter includes the names of multiple investigators. A sample of my data follows:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long(id grant2) strL(lead_investigator other_investigator) int grant_year 10000 509899 "Prof Ana Roz" "Prof Ana Roz; Prof Mar Pet; Prof Mic Ler; A/Prof Sus Gua; Dr Stu Geo" 2023 10001 500627 "A/Prof Bry Bor" "A/Prof Bry Bor; A/Prof Sal Tho; Prof Mar Ama; A/Prof Joe Hur" 2023 10002 684116 "Dr Ale Com" "Dr Ale Com; Dr Loi Roy; Dr Jua Nun" 2023 10003 266702 "Prof Man Che" "Prof Man Che; Prof Ker Hum; Prof Ken Trot" 2022 10004 465576 "Dr Geo Fri" "Prof Ana Roz; Dr Geo Fri; Prof Dr Sus Geb" 2022 10005 364875 "Dr Kat Bak" "A/Prof Bry Bor; Dr Kat Bak; Prof Ric Ric" 2021 10006 819627 "Prof And Bro" "Prof And Bro; Dr Ale Com; Dr Jul Viv" 2021 10007 611728 "Prof Owe Atk" "Prof Dr Gui Tch; Prof Owe Atk; Dr And Sca; Prof Gra Far; Prof Ste Sit" 2020 10008 411315 "Dr Dee Adh" "Prof Man Che; Dr Dee Adh; Prof Joh Car" 2020 10009 381647 "A/Prof Ivo Lab" "Prof Joh Car; A/Prof Ivo Lab; Asst Prof Rac Bez" 2020 10010 500028 "Prof Gra Ste" "Prof Gra Ste; Prof Qin Li" 2019 10011 423071 "Prof Roo Haz" "Prof Roo Haz; Prof Ben Ste" 2019 10012 537513 "Prof Aks Tan" "Prof Gra Ste; Prof Aks Tan; Prof Ala Cha; Prof Adr van" 2019 10013 398006 "Prof Vic Che" "Prof Vic Che; Dr Rut Kni" 2019 10014 435281 "Prof Joh Car" "Prof Vic Che; Prof Joh Car; Dr Dee Adh" 2019 end
Code:
bysort lead_investigator : egen grant_total = total(grant2)
Sincerely, Chris.
(Running Stata SE 17.0.)
Comment