Good afternoon everybody,
I'm working with a dataset generated by a repeated cross-section design. Thus, I have different individuals in each wave, while the investigated countries are the same. I need to create a variable that tells me to how many waves each country participated. In the example below country 1 participated to all 3 waves while country 2 skipped the first wave and participated to only 2 of them. How can I generate the "nwaves" variable in stata?
I'm working with a dataset generated by a repeated cross-section design. Thus, I have different individuals in each wave, while the investigated countries are the same. I need to create a variable that tells me to how many waves each country participated. In the example below country 1 participated to all 3 waves while country 2 skipped the first wave and participated to only 2 of them. How can I generate the "nwaves" variable in stata?
id. | wave | country | nwaves |
1 | 1 | 1 | 3 |
2 | 1 | 1 | 3 |
3 | 1 | 1 | 3 |
4 | 1 | 1 | 3 |
5 | 1 | 1 | 3 |
6 | 2 | 1 | 3 |
7 | 2 | 1 | 3 |
8 | 2 | 2 | 2 |
9 | 2 | 2 | 2 |
10 | 2 | 2 | 2 |
11 | 3 | 1 | 3 |
12 | 3 | 1 | 3 |
13 | 3 | 1 | 3 |
14 | 3 | 2 | 2 |
15 | 3 | 2 | 2 |
Comment