Hi,
I have around 2000 datasets and I would like to find the ones in which a certain variable has certain observations.
In particular, I want to find and re-save the datasets in which the variable "grade" takes the string letters: AB, BA or B
For example:
The thing is that my "grade" variable in some of the datasets does not take the values AB, BA and B (like below) and I would like to skip over those datasets.
I thought about using levelsof but I do not know how to implement it in this case.
How can I do that? Is there any other way?
Best
I have around 2000 datasets and I would like to find the ones in which a certain variable has certain observations.
In particular, I want to find and re-save the datasets in which the variable "grade" takes the string letters: AB, BA or B
For example:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id str2 grade 1 "AB" 2 "BA" 3 "BA" 4 "AB" 5 "B" 6 "AB" 7 "B" 8 "BA" 9 "B" 10 "B" end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(id grade) 1 4 2 5 3 2 4 3 5 5 6 1 7 5 8 3 9 3 10 2 end
How can I do that? Is there any other way?
Best
Comment