[EpiData-list] How to select earlier date from multiple dates

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Fri Sep 9 15:50:12 CDT 2011


On 2011-09-09 22:34, epidata-list at 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



More information about the EpiData-list mailing list