Hello, I'm quite new to stata. I have searched in this forum, but can not find the answer I need, though it is probably a very simple solution.
I have a dataset with 5 mill. observations of different happenings to approx. 2 mill. individuals. So for each individual ("PatientID") there are several observations. I want to keep only those individuals who have one variable ("acne-pat") in common. So for each individual I have "acne_pat"==1 in one of the individuals observation. How can I keep all the observations for thees individuals, and drop the rest? The result I want is the variable "Var2" in the example dataset.
Thank you,
Cathrine
I have a dataset with 5 mill. observations of different happenings to approx. 2 mill. individuals. So for each individual ("PatientID") there are several observations. I want to keep only those individuals who have one variable ("acne-pat") in common. So for each individual I have "acne_pat"==1 in one of the individuals observation. How can I keep all the observations for thees individuals, and drop the rest? The result I want is the variable "Var2" in the example dataset.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(PatientID acne_pat Var2) 1 1 1 1 . 1 1 . 1 2 . 0 2 . 0 3 1 1 3 . 1 3 . 1 4 1 1 4 . 1 5 . 0 5 . 0 5 . 0 end
Thank you,
Cathrine

Comment