My apologies. Here are 5 obs. data WORK.ESFEXPERIMENT1; infile datalines dsd truncover; input GiltID:32. entrydate:DATE9. dayOT:32. Trt:$8. _TYPE_:$1. _FREQ_:32. avgwt:32. totalfeed:32. totalfv:32. totalnfv:32. totalvisits:32. block:32. DOB:DATE. Age:32. Estrus1B:DATETIME. Estrus1E:DATETIME. AgeatPuberty:32. Estrus1Length:32. Estruswt1:32. Estrus2b:DATETIME. Estrus2e:DATETIME. Estrus2Length:32. Estruswt2:32. Eint:32. cycling:32. estrus3b:DATETIME. estrus3e:DATETIME. estrus3Length:32. estruswt3:32. Eint2:32. e160d:32. e170d:32. e180d:32. e190d:32. e200d:32. avgwtkg:32. Rep:32. ageOT:32. wt300by200d:32. wt136by200d:32. dayofestrous:32. where:32.; format entrydate DATE9. DOB DATE. Estrus1B DATETIME. Estrus1E DATETIME. Estrus2b DATETIME. Estrus2e DATETIME. estrus3b DATETIME. estrus3e DATETIME.; datalines4; 220810,09SEP2022,1,RS,1,1,193.12296,5.4938632,1,0,1,6,27MAR22,220,12SEP22:20:00:00,13SEP22:09:00:00,170,13,198,03OCT22:10:00:00,04OCT22:20:00:00,34,241,20.58,1,,,,,,0,1,1,1,1,87.67782384,1,166,0,0,1, 220810,10SEP2022,2,RS,1,2,,1.5696752,1,1,2,6,27MAR22,220,12SEP22:20:00:00,13SEP22:09:00:00,170,13,198,03OCT22:10:00:00,04OCT22:20:00:00,34,241,20.58,1,,,,,,0,1,1,1,1,,1,167,0,0,12, 220810,11SEP2022,3,RS,1,2,198.85492,5.9987166,1,1,2,6,27MAR22,220,12SEP22:20:00:00,13SEP22:09:00:00,170,13,198,03OCT22:10:00:00,04OCT22:20:00:00,34,241,20.58,1,,,,,,0,1,1,1,1,90.28013368,1,168,0,0,13, 220810,12SEP2022,4,RS,1,3,197.53216,5.9987166,3,0,3,6,27MAR22,220,12SEP22:20:00:00,13SEP22:09:00:00,170,13,198,03OCT22:10:00:00,04OCT22:20:00:00,34,241,20.58,1,,,,,,0,1,1,1,1,89.67960064,1,169,0,0,14, 220810,13SEP2022,5,RS,1,6,202.05159,1.7460432,3,3,6,6,27MAR22,220,12SEP22:20:00:00,13SEP22:09:00:00,170,13,198,03OCT22:10:00:00,04OCT22:20:00:00,34,241,20.58,1,,,,,,0,1,1,1,1,91.73142186,1,170,0,0,15, ;;;; In this instance, the new variable "Dayofestrous" would be, from top to bottom, -3,-2,-1,0,1... Note the estrus2b of 03oct22, Where when entrydate is 03oct22, dayofestrous would be 0 again. On average these animals exhibit a 21 day cycle, but that is not always true, which is why I bring up the idea of using estrus1b, 2b, 3b, etc to develop an observation based on information specific to that estrous cycle. Either way, when entrydate = estrus1b, estrus2b, or estrus3b, then dayofestrous=0 and goes either up or down from there until the next estrus date. Hope this gives the information you are looking for.
... View more