I have a large file of persons who have been drug-tested. The drug test dates have been arranged in chronological order, and the subjects in alpha order.
I need to calculate the number of days between the first and last drug tests for each person, and then calculate the mean days between first and last test for all persons in the file.
I have tried the lag function various ways to do this, but cannot develop a syntax that works for this calculation.
Thanks for your help. The following is an example of one case.
DOB DRUG TEST DATE
This topic has been locked.
Pinned topic Calculation of dates between lab tests
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Re: Calculation of dates between lab tests2012-12-26T18:34:26ZThis is the accepted answer. This is the accepted answer.Do you have a unique identifier for each case? If you do, I think you could sort your cases by your ID and drug test date, then use the AGGREGATE function to acquire the first and last test date for each unique case.
DATASET DECLARE test.
Then you can do your date computations.
Re: Calculation of dates between lab tests2013-01-04T16:41:32ZThis is the accepted answer. This is the accepted answer.
Re: Calculation of dates between lab tests2013-01-04T17:58:05ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK