I have a dataset with an identifier, with several obsevations for each identifier, let us call it ident, and a categorical variable var, that can take several values, among them 1.
How do I keep all observations corresponding to a common identifier if for just one of the observations I have var=var1
For instance, with
data Test;
input identifier var;
datalines;
1023 1
1023 3
1023 5
1064 2
1064 3
1098 1
1098 1
;
Then I want to keep
- 1023 1
- 1023 3
- 1023 5
- 1098 1
- 1098 1