Hi All
I hope you can help me with this query. I have attached a simplified dataset with all the variables needed (entrydate and exitdate are the start and end of the followup period and time is time at risk). Three individuals had outcome and three didn't. Exposure is a time varying covariate (repeated measure) and I want to create sequential start and stop time-variables corresponding to the exposures for each individual before running a Cox model. However, I am completely stuck with that and need help with coding to create these additional variables and run the Cox model afterwards. I have searched the forum and other sites, but I didn't find what I needed. The data looks like this:
Please help
Thanks
I hope you can help me with this query. I have attached a simplified dataset with all the variables needed (entrydate and exitdate are the start and end of the followup period and time is time at risk). Three individuals had outcome and three didn't. Exposure is a time varying covariate (repeated measure) and I want to create sequential start and stop time-variables corresponding to the exposures for each individual before running a Cox model. However, I am completely stuck with that and need help with coding to create these additional variables and run the Cox model afterwards. I have searched the forum and other sites, but I didn't find what I needed. The data looks like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte id float(entrydate exitdate exposure exposuredate time outcome outcomedate) 1 20490 21185 51 20643 695 0 . 1 20490 21185 53 20951 695 0 . 2 20402 21185 50 20426 783 0 . 2 20402 21185 52 20646 783 0 . 2 20402 21185 47 20667 783 0 . 3 20573 21185 47 20612 612 0 . 3 20573 21185 48 20955 612 0 . 3 20573 21185 47 21062 612 0 . 4 20430 21111 50 20579 681 1 21111 4 20430 21111 49 20726 681 1 21111 4 20430 21111 47 20950 681 1 21111 5 19640 20473 42 19950 833 1 20473 5 19640 20473 39 20048 833 1 20473 5 19640 20473 43 20431 833 1 20473 6 18441 18483 79 18445 42 1 18483 6 18441 18483 78 18445 42 1 18483 end format %tdDD/NN/CCYY entrydate format %tdDD/NN/CCYY exitdate format %tdDD/NN/CCYY exposuredate format %tdDD/NN/CCYY outcomedate
Please help
Thanks
Comment