Allow for missing data and put this first in the logic. Then the comparison should be OK. What I show is that you allow either MOUS or MOUSTR to be missing and then the comparison is not necessary.
CONSISTENCYBLOCK CHECK "impossible # treated nets" ((mous=.) or (moustr=.) or (MOUS >= MOUSTR)) CHECK "impossible # children sleeping under nets" ((enfants=.) or (dormi=.) or (ENFANTS >= DORMI) END
If you do not allow only one of the fields to be missing, you have to run the following first and fix all the records that do not comply:
consistencyblock check "Inappropriate missing values for MOUS or MOUSTR" ((mous<>.) and (moustr<>.)) end
This is easy to do in Analysis, but you still have to be careful about missing values, because you cannot trust the result of < or > on a missing value. In Analysis, of course, your intention is to select bad records, so the logic is reversed.
read yourdata select (mous<>.) and (moustr<>.) and (MOUS<MOUSTR) list id mous moustr select select (enfants<>.) and (dormi<>.) and (enfants<dormi) list id enfants dormi select
Jamie
On 2011-09-15, at 5:54 AM, epidata-list@lists.umanitoba.ca wrote:
I receive the following error with the CHK file coding that follows:
CHECK MOUS >= MOUSTR cannot apply opGTE to missing operands
And here's the coding:
CONSISTENCYBLOCK CHECK "impossible # treated nets" MOUS >= MOUSTR CHECK "impossible # children sleeping under nets" ENFANTS >= DORMI END