Hi there, I would like know how to drop all id with HIVStatus==1 and visit==1
I have tried "drop if HIVStatus==1 & visit==1" but it does not drop all rows of the same ID (i.e only rows that fit the conditions)
In other words, I would like to drop all id listed in "list id if HIVStatus==1 & visit==1"
Here is the example data
* Example generated by -dataex-. For more info, type help dataex
clear
input long Id float(HIVStatus visit)
48 0 1
48 0 2
48 0 3
217 0 1
217 0 2
217 0 3
261 . 1
265 . 1
271 0 1
271 0 2
271 0 3
403 . 1
411 . 1
411 . 2
500 0 1
500 . 3
537 . 1
537 . 3
564 0 1
614 0 1
614 0 3
633 1 1
633 1 3
708 0 1
708 0 2
end
label values visit visit
label def visit 1 "Baseline", modify
label def visit 2 "2018 Follow-up", modify
label def visit 3 "2019 Follow-up", modify
[/CODE]
This is my first STATALIST post and I am new to STATA so feel free to give your comments!
Also apologies for the possibly ambiguous title, I could not think of other ways to describe it.
I have tried "drop if HIVStatus==1 & visit==1" but it does not drop all rows of the same ID (i.e only rows that fit the conditions)
In other words, I would like to drop all id listed in "list id if HIVStatus==1 & visit==1"
Here is the example data
* Example generated by -dataex-. For more info, type help dataex
clear
input long Id float(HIVStatus visit)
48 0 1
48 0 2
48 0 3
217 0 1
217 0 2
217 0 3
261 . 1
265 . 1
271 0 1
271 0 2
271 0 3
403 . 1
411 . 1
411 . 2
500 0 1
500 . 3
537 . 1
537 . 3
564 0 1
614 0 1
614 0 3
633 1 1
633 1 3
708 0 1
708 0 2
end
label values visit visit
label def visit 1 "Baseline", modify
label def visit 2 "2018 Follow-up", modify
label def visit 3 "2019 Follow-up", modify
[/CODE]
This is my first STATALIST post and I am new to STATA so feel free to give your comments!
Also apologies for the possibly ambiguous title, I could not think of other ways to describe it.

Comment