Hello all,
My dataset comprises of women who are being followed up and are tested for pregnancy every 3 months. Even after testing positive for pregnancy they still are followed up however on the next visit the participant's pregnancy test result is recorded as negative or is missing.
I created variable preg_final where as long as a participant has a positive result for pregnancy recorded at any visit preg_final has it as pregnancy all visits. Wanted is the date of latest visit for those with negative pregnancy test and for those with a positive pregnancy test, its date when the test was found positive.
I am currently trying to stset the data, however I get this output.
[stset wanted , fail(preg_final==1) enter(firstdate) origin(firstdate) id(record_id) scale(365.25)]
id: record_id
failure event: preg_final == 1
obs. time interval: (wanted[_n-1], wanted]
enter on or after: time firstdate
exit on or before: failure
t for analysis: (time-origin)/365.25
origin: time firstdate
------------------------------------------------------------------------------
1,826 total observations
1,826 multiple records at same instant PROBABLE ERROR
(wanted[_n-1]==wanted)
------------------------------------------------------------------------------
0 observations remaining, representing
0 subjects
0 failures in single-failure-per-subject data
0 total analysis time at risk and under observation
at risk from t = 0
earliest observed entry t = .
last observed exit t = .
.
What could I possibly be doing wrong?
Please see below a sample of my data.
Thanks,
Galenda
My dataset comprises of women who are being followed up and are tested for pregnancy every 3 months. Even after testing positive for pregnancy they still are followed up however on the next visit the participant's pregnancy test result is recorded as negative or is missing.
I created variable preg_final where as long as a participant has a positive result for pregnancy recorded at any visit preg_final has it as pregnancy all visits. Wanted is the date of latest visit for those with negative pregnancy test and for those with a positive pregnancy test, its date when the test was found positive.
I am currently trying to stset the data, however I get this output.
[stset wanted , fail(preg_final==1) enter(firstdate) origin(firstdate) id(record_id) scale(365.25)]
id: record_id
failure event: preg_final == 1
obs. time interval: (wanted[_n-1], wanted]
enter on or after: time firstdate
exit on or before: failure
t for analysis: (time-origin)/365.25
origin: time firstdate
------------------------------------------------------------------------------
1,826 total observations
1,826 multiple records at same instant PROBABLE ERROR
(wanted[_n-1]==wanted)
------------------------------------------------------------------------------
0 observations remaining, representing
0 subjects
0 failures in single-failure-per-subject data
0 total analysis time at risk and under observation
at risk from t = 0
earliest observed entry t = .
last observed exit t = .
.
What could I possibly be doing wrong?
Please see below a sample of my data.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int record_id str23 redcap_event_name float(wanted firstdate) byte tpregtest_result float preg_final 1 "m3_arm_1" 23656 23229 2 0 1 "m9_arm_1" 23656 23229 2 0 1 "m15_arm_1" 23656 23229 2 0 1 "m12_arm_1" 23656 23229 2 0 1 "m6_arm_1" 23656 23229 2 0 1 "enrolment_arm_1" 23656 23229 . 0 12 "m15_arm_1" 23656 23236 2 0 12 "m12_arm_1" 23656 23236 2 0 12 "m6_arm_1" 23656 23236 2 0 12 "m3_arm_1" 23656 23236 2 0 12 "m9_arm_1" 23656 23236 2 0 12 "enrolment_arm_1" 23656 23236 . 0 13 "m3_arm_1" 23660 23237 2 0 13 "m15_arm_1" 23660 23237 2 0 13 "m12_arm_1" 23660 23237 2 0 13 "m6_arm_1" 23660 23237 2 0 13 "m9_arm_1" 23660 23237 2 0 13 "enrolment_arm_1" 23660 23237 . 0 14 "m12_arm_1" 23568 23237 2 0 14 "m9_arm_1" 23568 23237 2 0 14 "m3_arm_1" 23568 23237 2 0 14 "enrolment_arm_1" 23568 23237 2 0 14 "m6_arm_1" 23568 23237 2 0 15 "m9_arm_1" 23657 23237 2 0 15 "m3_arm_1" 23657 23237 2 0 15 "m15_arm_1" 23657 23237 2 0 15 "m6_arm_1" 23657 23237 2 0 15 "m12_arm_1" 23657 23237 2 0 15 "enrolment_arm_1" 23657 23237 . 0 16 "m12_arm_1" 23657 23237 2 0 16 "m3_arm_1" 23657 23237 2 0 16 "m15_arm_1" 23657 23237 2 0 16 "m9_arm_1" 23657 23237 2 0 16 "enrolment_arm_1" 23657 23237 . 0 16 "m6_arm_1" 23657 23237 . 0 17 "m12_arm_1" 23625 23238 1 1 17 "m15_arm_1" 23625 23238 2 1 17 "m6_arm_1" 23625 23238 . 1 17 "enrolment_arm_1" 23625 23238 . 1 17 "m3_arm_1" 23625 23238 . 1 18 "m12_arm_1" 23572 23238 1 1 18 "m9_arm_1" 23572 23238 2 1 18 "m6_arm_1" 23572 23238 2 1 18 "m3_arm_1" 23572 23238 2 1 18 "m15_arm_1" 23572 23238 . 1 18 "enrolment_arm_1" 23572 23238 . 1 19 "m12_arm_1" 23659 23238 2 0 19 "m3_arm_1" 23659 23238 2 0 19 "m6_arm_1" 23659 23238 2 0 19 "m15_arm_1" 23659 23238 2 0 19 "m9_arm_1" 23659 23238 2 0 19 "enrolment_arm_1" 23659 23238 . 0 20 "m12_arm_1" 23659 23238 2 0 20 "m3_arm_1" 23659 23238 2 0 20 "m6_arm_1" 23659 23238 2 0 20 "m9_arm_1" 23659 23238 2 0 20 "m15_arm_1" 23659 23238 2 0 20 "enrolment_arm_1" 23659 23238 . 0 21 "m12_arm_1" 23659 23239 2 0 21 "m9_arm_1" 23659 23239 2 0 21 "m15_arm_1" 23659 23239 2 0 21 "m3_arm_1" 23659 23239 2 0 21 "m6_arm_1" 23659 23239 2 0 21 "enrolment_arm_1" 23659 23239 . 0 24 "m6_arm_1" 23657 23240 2 0 24 "m12_arm_1" 23657 23240 2 0 24 "m9_arm_1" 23657 23240 2 0 24 "m15_arm_1" 23657 23240 2 0 24 "m3_arm_1" 23657 23240 2 0 24 "enrolment_arm_1" 23657 23240 . 0 end format %td wanted format %td firstdate label values tpregtest_result tpregtest_result_ label def tpregtest_result_ 1 "Positive", modify label def tpregtest_result_ 2 "Negative", modify label values preg_final preg_final_ label def preg_final_ 0 "No", modify label def preg_final_ 1 "Yes", modify
Thanks,
Galenda
Comment