Yeah, I tried that but the syntax was too long and EpiData cuts it after a few characters. What I'm trying to do now is to program it in the consistency bloc. These are the commands I've used:
after record ignoremissing if V1 + V2 + V3 + V4 + V5 + V6 + V7 + V8 <>12 then help "There may be an error when choosing the top 3 options" goto V1 endif end
consistency block report ID check "There may be an error when choosing the top 3 options" (2^V1+2^V2+2^V3+2^V4+2^V5+2^V6+2^V7+2^V8=14) end
What do you think about that? Can I use shorter commands?
Thanks for your help. Regards...
Serge 2013/8/5 epidata-list@lists.umanitoba.ca
Here is one way to do this.
v1 range 1 3 after entry if v1 <> . then if (v1 = v2) or (v1 = v3) or (v1 = v4) or (v1 = v5) or (v1 = v6) or (v1 = v7) or (v1 = v8) then help "You cannot have two choices the same." v1 = . goto v1 endif endif end end
v2 range 1 3 after entry if v2 <> . then if (v2 = v1) or (v2 = v3) or (v2 = v4) or (v2 = v5) or (v2 = v6) or (v2 = v7) or (v2 = v8) then help "You cannot have two choices the same." v2 = . goto v2 endif endif end end ---- add v3-v8 here in the same fashion ---
Jamie
On 2013-08-04, at 12:39 PM, epidata-list@lists.umanitoba.ca wrote:
I have a small constraint in my chk file and I wonder how I could program it. I have 8 options (8 variables V1 - V8). Interviewers are asked to chose their top 3 options. So that the legal values are 1, 2, 3 and there must not be the same value twice. I dont know how to write short instructions
to
check that. Thanks for your advices.
Serge.
EpiData-list mailing list EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list