New variable names from series of checkbox answers not working
I am relatively new to SAS and have no background in programming at all, but I have recently encountered a problem that even my PhD supervisors are stumped by. I conduced a survey on dairy cow management last year and many of the questions were checkboxes. The data came out to be a series of columns with either a number or a zero in each column; corresponding to a checked or unchecked answer for that particular aspect of the question. For example, this particularly problematic checkbox question pertains to pre-milking practices on dairy farms with 11 possible answers. I now want to make a new column (PREMILK) with all applicable checkbox answers in one column (i.e. any combination of ten PreMilk_X answers are possible; one answer (PreMilk_None) pertains to doing nothing so all other columns should be ‘0’), but it just won’t work.
Based on what I’ve read, I should not be overwhelming SAS with the amount of code. If I start with the “if everything equals 0 bar this one thing, call it ‘x'”, it refuses to compute any of the possible combinations. If I start with the combinations, it only names them with two characters (i.e. if a ‘4’ and a ‘6’ and a ‘7’ are checked, I try to rename it ‘467’ but only ’46’ is present in the new column). I need this column for univariate anaylsis for a mixed model using PROC MIXED.