05-30-2013 02:41 PM
I have a question about creating a new variable. I have multiple yes/no variables, what I want to do is create a "code" that is a combo of those variables so:
then code= 1010;
Any suggestions would be greatly appreciated.
05-30-2013 04:25 PM
Do any of the variables have missing values? If so, should they be treated differently than a "No" value?
I'm only asking because I have done similar and then realized that I had missing data and for that project missing should not be treated as "No".
05-31-2013 10:29 AM
For my project where I was building a similar composite we ended up deciding that just knowing a specific variable was missing. The resolution wa the composite was a string and the missing variables were coded with an underscore "_". I had a format designed to "parse" the coded string. If you needed specific reasons a variable was missing other charcters would work.
05-31-2013 01:05 AM
Easier if you code your original variables as numbers instead of strings. Then CATS() will work and generate string of 0's, 1's and dots (for the missing values).
proc format ;
invalue nn (upcase) 'YES'=1 'NO'=0 other=.;
input (n1-n4) (:nn3.);
put (_all_) (=);
yes no . yes
n1=1 n2=0 n3=. n4=1 flag=10.1
Need further help from the community? Please ask a new question.