|
地板

楼主 |
发表于 2011-2-25 10:14:44
|
只看该作者
Re: 求助:变量的频数统计并以一定的形式输出
[code:17eubzos]data one(where=(num ne ' '));
input var1 $1. @@;
if missing(var1) = 0;
retain id;
if anyalpha(var1) ne 0 then do; id=var1; output;end;
else do; num=var1; output; end;
drop var1;
cards;
x 1 2 1 2 1 2 1 2
y 1 2 3 4 1 2 3 4
;
run;
proc sql;
create table two as
select cats(id, '_', num) as var format=$3., count(*) as count
from one
group id, num
;quit;
[/code:17eubzos] |
|