Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(id x) 1 2 1 2 1 2 1 2 2 4 2 4 2 4 2 4 2 4 2 4 3 1 3 1 3 1 end
The purpose is, for each `id', to keep the number of `x' with the value of `x'. For example, when id=1, the value of `x' is 2. So, I'd like to keep 2 observations for this id. Similarly, for id=2, the value of `x' is 4. As such, I want to keep four observations for this id=2. Any suggestions?
0 Response to how to keep observations?
Post a Comment