Thank you Jens for suggestion. It was helpful. I was trying to automate at
entry, so did the following and it works,
*Bijay Adhikari*, PhD, MPH, DVM
Prov. Communicable Disease Epidemiologist
Population Health Branch
Saskatchewan Ministry of Health
Regina, SK Canada
Send EpiData-list mailing list submissions to
epidata-list@lists.umanitoba.ca
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.umanitoba.ca/mailman/listinfo/epidata-list
or, via email, send a message with subject or body 'help' to
epidata-list-request@lists.umanitoba.ca
You can reach the person managing the list at
epidata-list-owner@lists.umanitoba.ca
When replying, please edit your Subject line so it is more specific
than "Re: Contents of EpiData-list digest..."
EpiData-list mailing list
___________________________________
Today's Topics:
- Conditional formula (epidata-list@lists.umanitoba.ca)
- Re: Conditional formula (epidata-list@lists.umanitoba.ca)
Message: 1
Date: Fri, 11 Mar 2011 18:43:02 -0600
From: epidata-list@lists.umanitoba.ca
Subject: [EpiData-list] Conditional formula
To: epidata-list@lists.umanitoba.ca
Message-ID:
AANLkTik4syh1ti3z-sqV=SA+ULthRgmLrfYYxjpj_H-m@mail.gmail.com
Content-Type: text/plain; charset=ISO-8859-1
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,
If a= 1 and b = 1 then exposure= K
If a= 1 and b = 0 then exposure= K
If a= 1 and b = 1 and c= 1 then exposure= K
If a= 1 and b = 1 and c= 1 and d=0 then exposure= K
If a= 1 and b = 1 and c= 1 and d=1 then exposure= K
else exposure= K1
Thanks
--
*Dr. Bijay Adhikari*, PhD, MPH, DVM*
Prov. Communicable Disease Epidemiologist
Population Health Branch
Saskatchewan Ministry of Health
Regina, SK Canada
Message: 2
Date: Sat, 12 Mar 2011 10:45:12 +0100
From: epidata-list@lists.umanitoba.ca
Subject: Re: [EpiData-list] Conditional formula
To: epidata-list@lists.umanitoba.ca
Message-ID: 4D7B40A8.8080601@epidata.dk
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
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
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.
regards
Jens Lauritsen
EpiData Association
EpiData-list@lists.umanitoba.ca
http://lists.umanitoba.ca/mailman/listinfo/epidata-list
End of EpiData-list Digest, Vol 89, Issue 1