27 Aug
2012
27 Aug
'12
10:23 p.m.
Right - you could also define POFFSET as
gen i POFFSET = abs(.....)
or
if POFFSET<0 then POFFSET= -1*POFFSET // no need for [_n]
Jamie
On 2012-08-27, at 5:47 PM, epidata-list@lists.umanitoba.ca wrote:
sort ID PERIOD POFFSET
gen MARK=1 if (ID = ID[-1]) and (PERIOD=PERIOD[-1]) then MARK = 0
This is a great approach. I just want to add something. According to my understanding, this would make MARK=1 for the records with the smallest number of one set of ID and PERIOD. But it does not necessarily mean that the record with MARK=1 would be closest the expected date.