Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to keep variable x1,y1,z1 when rank =1 and keep x2,y2,z2 when rank=2 for different ids

    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
    Click image for larger version

Name:	var.png
Views:	2
Size:	33.8 KB
ID:	1702285


  • #2
    Duplicate post. Asked and answered at https://www.statalist.org/forums/for...value-of-var-y.

    Comment

    Working...
    X