Those with same id numbers are categorized into ranks and I want to keep percentage1 com11 pet1 when rank is 1 and so forth but after the first code Stata drops all rank which is not 1. Can someone please guide me. Thank You
if rank == 1 keep percentage1 com11 pet1
if rank == 2 keep percentage2 com12 pet2
if rank == 3 keep percenatge3 com13 pet3 Array