[EpiData-list] Conditional formula

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Sat Mar 12 03:45:12 CST 2011

Hello Epidata users, I am having problem to code conditional formula in
> epidata as described below, can anyone suggest how to code to the following
> condition,
I think the problem is that you should use more parenthesis. Is this in 
analysis or in entry ?

I assume analysis:

* first create the integer variable k:
define k #
* or you could use the gen statement: "i" makes this an integer variable
gen i k = 0

* give labels
labelvalue k /0="No" /1="Yes" /9="Missing"  /8="Not recoded"

* now for certain conditions change exposure to "no" or yes:
* I just give different examples
* first I give all the value 8 to make sure I am in control of the recoding:
k = 8
If ( (a= 1) and (b = 1)) then exposure= 0
If ( (f = 1) ) then exposure= 9
If ( (a= 1) and (b = 1) and (c = 1) and (d = 1) ) then exposure= 1
tab k
* if any records are stille with the value 8, then you would know there 
is a problem.

Jens Lauritsen
EpiData Association

More information about the EpiData-list mailing list