Dear Stata community,
Many thanks for all your help so far. Firstly I have found these forums so useful for my work.... I hope that I can contribute eventually (but for now I am still at a novice stage).
I have long panel data for multiple participant IDs. I would like to work out the number of days (or months) between each exam date (date_exam) for each participant (id). Time Zero is the first date for each participant (id).
My data is as follows:
I've tried searching the internet and stata youtube.... but can't find any codes/ formulas specific to my queries.
Very many thanks once again,
Best wishes,
Roshani
Many thanks for all your help so far. Firstly I have found these forums so useful for my work.... I hope that I can contribute eventually (but for now I am still at a novice stage).
I have long panel data for multiple participant IDs. I would like to work out the number of days (or months) between each exam date (date_exam) for each participant (id). Time Zero is the first date for each participant (id).
My data is as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(observation id) float(date_exam date_diff advanced_cuff) 3 1 15753 0 1 4 1 16117 . 0 5 1 16481 . 2 6 1 16519 . . 7 1 16705 . 1 8 1 17050 . 1 9 1 17090 . . 10 1 17286 . 1 11 1 17454 . 2 12 1 17636 . 1 13 1 17825 . . 14 1 18189 . 1 15 1 18546 . 1 16 1 18910 . 2 17 1 19099 . 2 18 1 19540 . 0 19 1 19988 . 1 20 1 20849 . . 21 1 21327 . 1 22 1 21622 . 2 24 3 14321 0 1 25 3 15263 . 0 26 3 15766 . 0 27 3 16362 . 0 28 3 17100 . 0 29 3 17461 . 0 30 3 17827 . 0 31 3 18191 . 1 32 3 18968 . 1 33 3 19472 . 0 34 3 20298 . 0 35 3 20886 . 2 37 3 21142 . 2 38 3 21369 . 2 44 4 20828 0 1 45 4 21314 . 1 47 5 17023 0 1 48 5 17349 . 0 49 5 17720 . 2 50 5 18084 . 2 end format %tdDD/NN/CCYY date_exam
Very many thanks once again,
Best wishes,
Roshani
Comment