[EpiData-list] Select top 3 among 8

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Sun Aug 4 22:16:25 CDT 2013


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 at 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.



More information about the EpiData-list mailing list