Hi everyone,
I am trying different alternatives in order to achieve what I want in my data, but I am not able to do so...
My problem is the next:
I want to generate group identifiers on two variables, but not uniquely identified in the second. The uniquely identified would be the mix (concatenation) of both variables.
The first variable corresponding to the client, the second variable to the commerce, I want that the second identifier (the commerce) start again the numbering every time that the client changes. If for instance there are 3 commerce on the same client, the enumeration would be 1, 2, 3. and when the next client appears, and there are 4 commerce in this client, the enumeration would be again 1, 2, 3, 4....
I have tried with egen group, valid on the first identifiers (the client), but egen by client and commerce brings the same result that using the egen by commerce.
Below an example, giving names of clients and commerce better than client1 client2, commerce1 commerce2, because I consider in this way is much more clarification and being WIW variable What I Want to achieve.
Thank you in advance.
Kyko Ortega
I am trying different alternatives in order to achieve what I want in my data, but I am not able to do so...
My problem is the next:
I want to generate group identifiers on two variables, but not uniquely identified in the second. The uniquely identified would be the mix (concatenation) of both variables.
The first variable corresponding to the client, the second variable to the commerce, I want that the second identifier (the commerce) start again the numbering every time that the client changes. If for instance there are 3 commerce on the same client, the enumeration would be 1, 2, 3. and when the next client appears, and there are 4 commerce in this client, the enumeration would be again 1, 2, 3, 4....
I have tried with egen group, valid on the first identifiers (the client), but egen by client and commerce brings the same result that using the egen by commerce.
Below an example, giving names of clients and commerce better than client1 client2, commerce1 commerce2, because I consider in this way is much more clarification and being WIW variable What I Want to achieve.
[client] | [commerce] | [egen cod_client=group(client)] | [egen cod_client=group(commerce)] | [egen cod_client=group (client commerce)] | [WIW] |
ONEBTW | ONEBTW LASNAS | 1 | 1 | 1 | 1 |
ONEBTW | ONEBTW LASNAS | 1 | 1 | 1 | 1 |
ONEBTW | ONEBTW LASNAS | 1 | 1 | 1 | 1 |
ONEBTW | ONEBTW LASNAS | 1 | 1 | 1 | 1 |
ONEBTW | ONEBTW LASNAS | 1 | 1 | 1 | 1 |
ONEBTW | ONEBTW LASNAS | 1 | 1 | 1 | 1 |
A.B.P. | A.B.P. SALOM | 2 | 2 | 2 | 1 |
A.B.P. | A.B.P. SALOM | 2 | 2 | 2 | 1 |
A.B.P. | A.B.P. SALOM | 2 | 2 | 2 | 1 |
A.B.P. | A.B.P. SALOM | 2 | 2 | 2 | 1 |
A.M. | A.M. FUENEN | 3 | 3 | 3 | 1 |
A.M. | A.M. FUENEN | 3 | 3 | 3 | 1 |
A.M. | A.M. FUENEN | 3 | 3 | 3 | 1 |
A.M. | A.M. ARREC | 3 | 4 | 4 | 2 |
A.M. | A.M. ARREC | 3 | 4 | 4 | 2 |
A.M. | A.M. ARREC | 3 | 4 | 4 | 2 |
A.M. | A.M. LAPAM | 3 | 5 | 5 | 3 |
A.M. | A.M. LAPAM | 3 | 5 | 5 | 3 |
A.M. | A.M. LAPAM | 3 | 5 | 5 | 3 |
A.M. | A.M. LAPAM | 3 | 5 | 5 | 3 |
ANOVA | ANOVA PALO | 4 | 6 | 6 | 1 |
ANOVA | ANOVA PALO | 4 | 6 | 6 | 1 |
ANOVA | ANOVA PALO | 4 | 6 | 6 | 1 |
ANOVA | ANOVA PALO | 4 | 6 | 6 | 1 |
ANOVA | ANOVA TOGO | 4 | 6 | 6 | 2 |
ANOVA | ANOVA TOGO | 4 | 6 | 6 | 2 |
Thank you in advance.
Kyko Ortega
Comment