SAS中文论坛

标题: 如何得到特定观测的个数 [打印本页]

作者: shiyiming    时间: 2009-10-26 11:03
标题: 如何得到特定观测的个数
如题,数据集中要得到同一个ID的观测条数
作者: shiyiming    时间: 2009-10-26 23:23
标题: Re: 如何得到特定观测的个数
[code:jdwv9zsz]data a;
input no $ singn;
datalines;
s1 1
s1 1
s1 2
s2 1
s2 2
s2 2
s3 1
s3 1
s4 2
s4 2
;
proc sql;
select no,count(no) as contno  from a group by no;
select no,singn,count(no and singn) as contsn from a group by no,singn;
quit;[/code:jdwv9zsz]
作者: shiyiming    时间: 2009-10-28 11:11
标题: Re: 如何得到特定观测的个数
是不是只要count有观测数值的obs就可以了?

proc means data=aa noprint;
        by no;
        var sign;
        output out=count(drop=_type_ _freq_) N=/autoname;
run;




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2