Hello! I'm trying to create a variable that just pools all of the participants responses into one variable. For example, there was a question that ask which following fruits do you eat? The participants can check off whether or not they eat each option, where 1=they checked it. So I want to create a variable where all the yes responses are in just one if that make senses. When I run this code, I don't get any errors and the variable is created, however I noticed through PROC FREQ the frequency doesn't match the original variables-so I am wondering how to make sure it is pulling things correctly or what is happening for it to be getting the wrong number of observations? I am not sure creating the variable using the if function is possible as that is most familiar method I use to create new variables. I am not familiar with arrays but would would that be better? if q_apple=1 then fruits="apple"; else if q_orange=1 then fruits="orange"; else if q_banana=1 then fruits="banana"; else if q_grapes=1 then fruits="grapes"; else if q_watermelon=1 then fruits="watermelon"; else if q_strawberries=1 then fruits="strawberries"; else if q_bb=1 then fruits="blueberries"; else if q_ch=1 then fruits="cherries"; else if q_other=1 then fruits="Other";
... View more