I have school district-level data that contains three variables indicating the percentage of students in the district receiving a certain instruction type: remote, in-person and hybrid. Each row is a unique district. I do the following:
Code:
egen max = rowmax(in_person remote hybrid) gen inst_type = "" replace inst_typ = "in_person" if max == in_person replace inst_typ = "hybrid" if max == hybrid replace inst_typ = "remote" if max == remote
district_id | remote_pct | hybrid_pct | in_person_pct | max | inst_type |
1 | 88.5 | 11.5 | 0 | 88.5 | remote |
2 | 11.5 | 77.8 | 5.1 | 77.8 | "" |
3 | 94.4 | 0 | 5.6 | 94.4 | "" |
4 | 23.1 | 74.1 | 2.8 | 74.1 | "" |
Thanks for the help.
0 Response to Identifying variable that contains rowmax value
Post a Comment