Hi,
There is probably a very easy solution to this, but I simply cannot figure out how to do it. I have searched the forum without luck.
I need to generate a variable (cycle_number) that counts numbers of new chemotherapy cycles within each patient (defined by a change in the date).
This is an example of what I have:
This is what I want to obtain:
Thank you for the help.
There is probably a very easy solution to this, but I simply cannot figure out how to do it. I have searched the forum without luck.
I need to generate a variable (cycle_number) that counts numbers of new chemotherapy cycles within each patient (defined by a change in the date).
This is an example of what I have:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id date) 1 18597 1 18598 1 18598 1 18599 1 18600 2 20259 2 20259 2 20259 2 20266 2 20266 end format %td date
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id date cycle_number) 1 18597 1 1 18598 2 1 18598 2 1 18599 3 1 18600 4 2 20259 1 2 20259 1 2 20259 1 2 20266 2 2 20266 2 end format %td date
Comment