How to select earlier date from multiple dates
Dear Forum Members,
I was looking a way to select earliest date from multiple date fields. Example,
Five date fields with dates as below, DateA - 13/01/2002 DateB - *13/01/2001* DateC - 13/01/2002 DateE - 13/01/2003 DateF - 13/01/2004
So, the programming to select earliest date (13/01/2001) in the field called "DateDiagnosis"
Thanks in advance.
Bijay Adhikari, PhD CD Epidemiologist Regina, SK
On 2011-09-09 22:34, epidata-list@lists.umanitoba.ca wrote:
Dear Forum Members,
I was looking a way to select earliest date from multiple date fields. Example,
Five date fields with dates as below, DateA - 13/01/2002 DateB - *13/01/2001* DateC - 13/01/2002 DateE - 13/01/2003 DateF - 13/01/2004
So, the programming to select earliest date (13/01/2001) in the field called "DateDiagnosis"
I have not tested this solution, but I would do something like:
I assume this is in analysis: define datetmp <dd/mm/yyyy>
datetmp = datea if (dateb < datetmp) then datetmp = dateb if (datec < datetmp) then datetmp = datec if (dated < datetmp) then datetmp = dated if (datee < datetmp) then datetmp = datee if (datef < datetmp) then datetmp = datef if (dateg < datetmp) then datetmp = dateg
* now the datetmp contains the earliest of the dates mentioned.
regards Jens Lauritsen EpiData Association
participants (1)
-
epidata-list@lists.umanitoba.ca