Hi, Sorry for the late reply, I had this on a SAS session which crashed yesterday when I was working on it, so am posting this late (note that you could replace the yes_results and no_results with a multi level array, but I kept It like this for simplicity: data have; attrib q1 q2 q3 q4 format=$10.; infile cards dlm=','; input q1 $ q2 $ q3 $ q4 $; cards; yes,no,yes,yes no,yes,yes,yes yes,yes,no,no ; run; data want (drop=i); set have end=last; attrib quarter format=best. yes no format=$20.; array q{4}; array yes_results{4} (0,0,0,0); array no_results{4} (0,0,0,0); do i=1 to 4; if q{i}="yes" then yes_results{i}=yes_results{i}+1; if q{i}="no" then no_results{i}=no_results{i}+1; end; if last then do; do i=1 to 4; quarter=i; yes="%"||strip(put( (yes_results{i} / 4) * 100,best.)); no="%"||strip(put( (no_results{i} / 4) * 100,best.)); output; end; end; run;
... View more