/*方法一*/
proc freq data=a noprint;
tables w1 /out=b(drop=percent rename=(count=w3));
run;
/*方法二*/
proc sql;
create table b as
select w1,count(*) as w3
from a
group by w1;
quit;
/*方法三*/
proc sort data=a(keep=w1) out=b;
by w1;
run;
data b;
set b;
by w1;
if first.w1 then w3=0;
w3+1;
if last.w1;
run;
/*还有其他方法省略*/