Using SAS Version 9.3 I would like to create a variable name SSB which if all of the variables (each of them are binary are 0 and 1) =0 (therefore using AND) then it should be =0 and if any of the variables have =1 then that would =1 (therefore using OR) See code below. This is not working however but I don't want the 0's to be OR's since that is not what I want to capture.... if eat_fruitjuice_m_r =0 AND eat_100juice_m_r =0 AND eat_juicedrink_m_r =0 AND eat_soda_m_r =0 AND eat_ssb_m_r =0 AND eat_sugarwater_m_r=0 AND eat_tea_m_r =0 AND eat_vegjuice_m_r=0 then SSB=0; else if eat_fruitjuice_m_r ne . and eat_fruitjuice_m_r=1 OR eat_100juice_m_r ne . and eat_100juice_m_r=1 OR eat_juicedrink_m_r ne . and eat_juicedrink_m_r =1 OR eat_soda_m_r ne . and eat_soda_m =1 OR eat_ssb_m_r ne . and eat_ssb_m_r=1 OR eat_sugarwater_m_r ne . and eat_sugarwater_m_r=1 OR eat_tea_m_r ne . and eat_tea_m_r =1 OR eat_vegjuice_m_r ne . and eat_vegjuice_m_r=1 then SSB=1; Suggestions?
... View more