Hi I have to rename 5 variables A B C D E (that were selected yes = 1 no = 0) to become one variable X with key values of 1-5 BUT we can have multiple values. So X can be a 1 or 1,2 or 2 or 1,2,3 or 3 or 1,2,3,4 or 4 or 1,2,3,4,5 or 5. So I thought of doing this: if A =1 then X =1; if B= 1 then X =2; if C =1 then X =3; if D then X =4; if E= 1 then X =5; else if (A =1 and B = 1) then X=1,2; if (A =1 and B = 1 C =1) then X=1,2,3; if (A =1 and B= 1 and C =1 and D=1) then X =1,2,3,4; if (A =1 and B = 1 and C=1 and D=1 and E= 1) then X=1,2,3,4,5; Run; but this does not work. Error message: Expecting an arithmetic operator (where the commas were added) I changed the comma with the word and. It "works" but it keeps only one of the values. so in if (A =1 and B= 1 and C =1 and D=1) then X =1 and 2, and 3 and 4; It keeps only one value. Should I have an array instead ? And if so, how can I tell sas to keep all the values when needed ? Thank you in advance.
... View more