Dear Stata users,
I wonder if there is an easy way to generate 'start' and 'stop' days from baseline from using long format data.
Dataex:
I would like to create the following data.
Many thanks,
Oyun
I wonder if there is an easy way to generate 'start' and 'stop' days from baseline from using long format data.
Dataex:
PHP Code:
----------------------- copy starting from the next line -----------------------
[CODE]
* Example generated by -dataex-. For more info, type help dataex
clear
input byte id str9(medication days_from_baseline) byte event
3 "D-penicil" "0" 0
3 "D-penicil" ".48187494" 0
3 "D-penicil" ".99660498" 0
3 "D-penicil" "2.0342789" 0
3 "D-penicil" "2.7707808" 1
5 "placebo" "0" 0
5 "placebo" ".54484725" 0
5 "placebo" "1.070529" 0
5 "placebo" "2.1054649" 0
5 "placebo" "3.0062425" 0
5 "placebo" "3.9836819" 0
5 "placebo" "4.1205783" 0
end
[/CODE]
------------------ copy up to and including the previous line ------------------
I would like to create the following data.
PHP Code:
id medication start stop event
3 D-penicil 0 .48187494 0
3 D-penicil .48187494 .99660498 0
3 D-penicil .99660498 2.0342789 0
3 D-penicil 2.0342789 2.7707808 1
5 placebo 0 .54484725 0
5 placebo .54484725 1.070529 0
5 placebo 1.070529 2.1054649 0
5 placebo 2.1054649 3.0062425 0
5 placebo 3.0062425 3.9836819 0
5 placebo 3.9836819 4.1205783 0
Many thanks,
Oyun

Comment