/ Published in: SAS

Below is some code written for creating one response from survey questions where the respondent checks all that apply.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
proc format; value respfmt 0='jim' 2='joe' 4='jon' 8='jan' 6='jake' 10='jack' 12='jill' 14='josh'; run; data have; input response1-response3; cards; 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 1 ; data want (drop=i); set have; array resp(*) response1-response3; format responses respfmt.; responses=0; do i=1 to 3; if resp(i) eq 1 then responses+2**i; end; run; proc print data=want; run;
Comments
