data have;
attrib respid format=best. status format=$20. S7_1 S7_2 S7_3 S7_4 format=best.;
infile datalines delimiter=" " missover;
input respid status $ s7_1 s7_2 s7_3 s7_4;
datalines;
8 complete 10
21 complete 10 9
54 complete 4 2
67 complete 10 9
75 complete 10 9
93 complete 10 8
111 complete 10 9
134 complete 10 9 6
169 complete 10 9 6 10
;
run;
data temp;
set have;
length age $ 8;
array a{*} s7: ;
do i=1 to dim(a);
if not missing(a{i}) then do;age=strip(a{i}); output; end;
end;
keep age;
run;
proc sql;
create table want as
select ' Base' as age,(select count(age) from temp) as Freq from temp(obs=1)
union
select ' Less Than 1' as age,(select count(age) from temp where input(age,best8.) lt 1) as Freq from temp(obs=1)
union
select age,count(age) as Freq from temp group by age;
quit;
Xia Keshan
... View more