Hello! i have two questions.. I think they are related though. I'll present both issues just in case. So I have 6 mutually exclusive groups. Group 1 is people who only have trauma#1, group 2 is only people who have trauma#3, group 3= people who only have Trauma#5, group 4= people who have only Trauma#1 and Trauma#3, group 5 = people who only have trauma#1 and trauma#5, and group 6 = people who only have trauma#3 and trauma#5. Each trauma has the same variables, but they are modified to reflect which trauma they apply to. So I want to see, for example, who had trauma inflicted on them by a parent. the variable is t"x"perp, where x = the trauma#. So I have this the code, but I feel that it is pretty messy. I do this for sibling, other adult, and other youth. /*Parent*/ if group = 1 and t1perp=1 then parent = 1; else if group = 2 and t3perp=1 then parent = 1; else if group = 3 and t5perp=1 then parent = 1; else if group = 4 and (t1perp =1 or t3perp =1) then parent =1; else if group = 5 and (t1perp =1 or t5perp =1) then parent =1; else if group = 6 and (t3perp =1 or t5perp =1) then parent =1; /*Other adult relative*/ if group = 1 and t1perar=1 then otheradult = 1; else if group = 2 and t3perar=1 then otheradult = 1; else if group = 3 and t5perar=1 then otheradult = 1; else if group = 4 and (t1perar =1 or t3perar =1) then otheradult =1; else if group = 5 and (t1perar =1 or t5perar =1) then otheradult =1; else if group = 6 and (t3perar =1 or t5perar =1) then otheradult =1; /*Sibling*/ if group = 1 and t1persb=1 then sibling = 1; else if group = 2 and t3persb=1 then sibling = 1; else if group = 3 and t5persb=1 then sibling = 1; else if group = 4 and (t1persb =1 or t3persb =1) then sibling =1; else if group = 5 and (t1persb =1 or t5persb =1) then sibling =1; else if group = 6 and (t3persb =1 or t5persb =1) then sibling =1; What would be the best way to condense this? Macro?Array? I think hard-coding the way I have is very elementary/amateurish and susceptible to error . Second issue: I want to know for those who are in groups 3, 5, or 6 (i.e., they're the groups with subjects who have endorsed trauma#5), I want to see the type of subtypes they have if they have 3 subtypes. There are multiple combinations though, Any ideas on how to condense this code? You can endorse any 3 of the 5. array subtype {5} t5typt5 t5typen t5typva t5typed t5typoth; if group in (3,5,6) and subtype{1}=. & subtype{2}=. & subtype{3} = . & subtype{4}=. and subtype{5}=. then combotype3=0; if group in (3,5,6) and subtype{1}=1 & subtype{2}=1 & subtype{3} = 1 & subtype{4} ne 1 & subtype{5} ne 1 then combotype3=1; else if group in (3,5,6) and subtype{1}=1 & subtype{2}=1 & subtype{4} = 1 & subtype{3} ne 1 & subtype{5} ne 1 then combotype3=2; else if group in (3,5,6) and subtype{1}=1 & subtype{2}=1 & subtype{5} = 1 & subtype{3} ne 1 & subtype{4} ne 1 then combotype3=3; else if group in (3,5,6) and subtype{1}=1 & subtype{3}=1 & subtype{4} = 1 & subtype{2} ne 1 & subtype{5} ne 1 then combotype3=4; else if group in (3,5,6) and subtype{1}=1 & subtype{3}=1 & subtype{5} = 1 & subtype{2} ne 1 & subtype{4} ne 1 then combotype3=5; else if group in (3,5,6) and subtype{1}=1 & subtype{4}=1 & subtype{5} = 1 & subtype{2} ne 1 & subtype{3} ne 1 then combotype3=6; else if group in (3,5,6) and subtype{2}=1 & subtype{3}=1 & subtype{4} = 1 & subtype{1} ne 1 & subtype{5} ne 1 then combotype3=7; else if group in (3,5,6) and subtype{2}=1 & subtype{3}=1 & subtype{5} = 1 & subtype{1} ne 1 & subtype{4} ne 1 then combotype3=8; else if group in (3,5,6) and subtype{2}=1 & subtype{4}=1 & subtype{5} = 1 & subtype{1} ne 1 & subtype{3} ne 1 then combotype3=9; else if group in (3,5,6) and subtype{3}=1 & subtype{4}=1 & subtype{5} = 1 & subtype{1} ne 1 & subtype{2} ne 1 then combotype3=10; Also if you know of any resources I can consult to learn more about arrays I'd appreciate it.. suggestions are welcome Thanks!
... View more