Hi all, i would like to add a new variable with a counter. For the following dataset I would like to add a 4th variable which will be the mentioned counter. The counter should count the number of B observations for a given A observation when the filter equals 1. For example: the first count value should be 2 because the observation "1" in B occurs twice for the observation "1" in A given that the filter equals 1. * Example generated by -dataex-. To install: ssc install dataex clear input int(A B filter) 1 1 1 1 2 0 1 3 0 1 2 0 1 3 1 1 1 1 1 4 0 2 4 0 2 2 1 2 3 1 2 3 0 3 1 0 3 2 0 end I would appreciate any kind of help. Thank you very much.
-
Login or Register
- Log in with
Comment