Hi
I have the following dataset.
ClientID Nurses
1 A
1 B
1 A
2 A
2 A
3 C
3 A
3 A
Now, I will need to find the number of nurses for each client during their episode of care. Therefore, I would like to see the following.
ClientID Nurses n_nurses
1 A 2
1 B 2
1 A 2
2 A 1
2 A 1
3 C 2
3 A 2
3 A 2
What command should I use.
I tried
sort ClientID Nurses
by ClientID Nurses: gen n_nurses=_n
But it doesn't work.
Thanks in advance.
I have the following dataset.
ClientID Nurses
1 A
1 B
1 A
2 A
2 A
3 C
3 A
3 A
Now, I will need to find the number of nurses for each client during their episode of care. Therefore, I would like to see the following.
ClientID Nurses n_nurses
1 A 2
1 B 2
1 A 2
2 A 1
2 A 1
3 C 2
3 A 2
3 A 2
What command should I use.
I tried
sort ClientID Nurses
by ClientID Nurses: gen n_nurses=_n
But it doesn't work.
Thanks in advance.
Comment