Summing a number of variables
![](https://secure.gravatar.com/avatar/f174b9816ccce31bf5cdb49501b15358.jpg?s=120&d=mm&r=g)
The easiest way of summing:
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.
What I would do is:
dateexit1 AFTER ENTRY if dateexit1 = . then goto daysadm1 endif end end
dateexit2 AFTER ENTRY if dateexit2 = . then goto daysadm endif end end
etc for the other dateexit3 to 5.
daysadm before entry * assume you have at least data in the first var: daysadm=(dateexit1-dateentry1) if dateexit2 <> . then daystotadm =(dateexit2-dataentry2) + daysadm endif if dateexit3 <> . then daystotadm =(dateexit3-dataentry3) + daysadm endif if dateexit4 <> . then daystotadm =(dateexit4-dataentry4) + daysadm endif if dateexit5 <> . then daystotadm =(dateexit5-dataentry5) + daysadm endif goto ... next variable end end
In this way when the first dateexit is equal to ., the program jumps and no entry is needed in ... up to number 5 variable. (I hope the comparison of date variable with . works - did not test it).
Regarding the other question from yesterday. Installation of EpiData software (entry and analysis) is always very "clean", meaning not disturbing the PC, so you can have many copies if you wish for various purposes. Just copy the exe file (plus help if needed). When testing I tend to create the default for testing as: c:\epidataanalysistest such that the test version of analysis does not interfere with the release version.
regards jens lauritsen EpiData Association
participants (1)
-
epidata-list@lists.umanitoba.ca