
You will need to split this up into nested IF blocks. As well, you really should have parentheses to group the conditions between ANDs, to be sure the logic is what you want. You cannot be sure what order the AND and OR operators are applied.
For example, you might try something like this.
if (sex=2 and (msex=0 or msex=9 or msex=99) and (fsex=0 or fsex=9 or fsex=99) then if (idu=0 or idu=9 or idu=99) and (cfac=0 or cfac=9 or cfac=99) then if ... then risk="OtherMedExp-10" endif endif endif
I would put all of the related fields/values in one if. I don't know whether there is a limit to the number of nested IF blocks, but you probably won't have a problem. This works as long as logically you want AND between the IF blocks. I think that is the case here.
Jamie
On 2011-07-11, Bijay wrote:
IF (Sex=2) AND (Msex=0) OR (Msex=9) OR (Msex=99) AND (Fsex=0) OR(Fsex=9) (Fsex=99) AND (IDU=0) OR (IDU=9) OR (IDU=99) AND (CFac=0) OR (CFac=9) OR (CFac=99) AND(Trans=0) OR (Trans=9) OR (Trans=99) OR (coag=0) OR (coag=9) OR (coag=99) OR(HetSexEND=0) OR (HetSexEND=9) OR (HetSexEND=99) OR (ConSusHIV=0) OR (ConSusHIV=9) OR(ConSusHIV=99) AND (OccuExp=0) OR (OccuExp=9) OR (OccuExp=99) AND (OthMedExp=1) OR(OthMedExp=0) OR (OthMedExp=9) OR (OthMedExp=99) AND (NMNOcc=1) OR (NMNOcc=0) OR(NMNOcc=9) OR (NMNOcc=99) *THEN*
* **Risk="OtherMedExp-10"*