[EpiData-list] how to sum numeric variables even if one of the variables is empty

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Fri Aug 3 10:35:39 CDT 2007





Hello
I would like to make an automatic sum (see: variable "daystotadm") of a
series of variables (see: variable "daysadm1-2..."), but if only one of
these variable is empty, the automatic calculation using the function SUM
give a null result.
Do anyone know a way to solve this problem without the need to enter a
value for each variable. In my file I don not necessarily enter all the
five lines and the number of days is already a calculated field?
I attach the qes and the check files
Thank you
Francesco Grandesso




QES FILE
---------------------------------------------------------------------------------


                  Date of entry               Date of exit
Number of days
                 --------------------------------------------
---------------
       {dateentry1} <dd/mm/yyyy>     {dateexit1} <dd/mm/yyyy>
{daysadm1}  ###
       {dateentry2} <dd/mm/yyyy>     {dateexit2} <dd/mm/yyyy>
{daysadm2}  ###
       {dateentry3} <dd/mm/yyyy>     {dateexit3} <dd/mm/yyyy>
{daysadm3}  ###
       {dateentry4} <dd/mm/yyyy>     {dateexit4} <dd/mm/yyyy>
{daysadm4}  ###
       {dateentry5} <dd/mm/yyyy>     {dateexit5} <dd/mm/yyyy>
{daysadm5}  ###
                 --------------------------------------------
---------------
       {daystotadm}                                                Total
days ####





CHK FILE
----------------------------------------------------------------------------------


dateexit1
  AFTER ENTRY
    daysadm1=(dateexit1-dateentry1)
    daystotadm=SUM(daysadm1,daysadm2,daysadm3,daysadm4,daysadm5)
  END
END

daysadm1
  NOENTER
END

.................... and so on for each of the five dateexit* and daysadm*
variables



__________________________________________
Francesco Grandesso
EPICENTRE
8, Rue Saint Sabin
75011 Paris, France
tel         +33 (0)1 4021 2847
fax        +33 (0)1 4021 2803
email    Francesco.GRANDESSO at epicentre.msf.org



More information about the EpiData-list mailing list