@sschleede: Thanks, dataset want is updated as there were some typing errors. ID 2, week 12, ntime 0, first observation - why is time = 1400? I didn't see any requirement to change the value of time. Why is time1 = 1420 instead of 1424 - 24 = 1400? ## this is corrected in the want dataset ID 2, week 12, ntime 2 - why isn't there a record in your output dataset with time = 1424 to match the record in the have dataset? ## corrected ID 1, week 4, ntime 2, time 718 - why is value = 650? first occurance of ntime=2 and week=4 always contains missing vaule. but the subsequent row with same values of ntime(ntime=2) and week(week=4) contains non-missing values. it could be any value. ID 2, week 4, ntime 2, time 718 - why is value = .? This isn't the first observation for the week. ## value =. because that the first value for the combination of ntime=2 and week=4. time week 0 4 0 4 2 4 2 4 only for the first occurance of time and week time1 will be updated. however, in the foloowing case, where time 0 is missing then time1 will calculated for the first occurnce of time=2 week=4 time week . 4 2 4 2 4
... View more