Dear All, In a previous thread (https://www.statalist.org/forums/for...ximum-time-gap), I mis-stated my question (as conjectured by Clyde Schechter). Thus, I re-state the question below (and hope this does not violate the regulation of this forum). The data set is:
For each id, I'd like to calculate the time between any pairs of -ymd- (I have done: sort id ymd). For instance, for id=1, I need to calculate times between any (actually 6) combinations of ymd, i.e., 2008.12.15-2008.10.01; 2009.01.10-2008.10.01; 2009.05.01-2008.10.01; 2009.01.10-2008.12.15; 2009.05.01-2008.12.15; and 200.05.01-2009.01.10). If any of the time differences is falling between 30-365 (in terms of days), then this id is what I want. Any suggestions?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id str12 ymd float n 1 "2008.10.01" 1 1 "2008.12.15" 2 1 "2009.01.10" 3 1 "2009.05.01" 4 2 "2008.08.15" 1 2 "2008.10.01" 2 2 "2008.12.15" 3 2 "2008.12.31" 4 2 "2009.01.31" 5 2 "2009.05.31" 6 2 "2009.08.31" 7 end
Comment