所以我用SUM运行PROC Summary来确定某事物的频率,但是我只有160个观测值,但是我遇到的问题是频率之和为161。我仔细检查了原始数据集是否有160观察和所有东西,但有某些东西使频率161升高,我不确定是什么。
我尝试了一些代码
PROC SQL;
CREATE TABLE DiseaseFreq AS
SELECT Concomitant_Disease,
count(*) AS Freq
FROM CAS.PreOp
GROUP BY Concomitant_Disease;
QUIT;
DATA Disease (KEEP=var freq RENAME=var=Concomitant_Disease);
SET DiseaseFreq;
LENGTH var $25. freq 3.;
DO i=1 BY 1 WHILE(SCAN(Concomitant_Disease,i,"~^,")^='');
var=STRIP(PROPCASE(SCAN(Concomitant_Disease,i,"~^,")));
Freq=Freq;
OUTPUT;
END;
RUN;
PROC SUMMARY DATA=Disease;
CLASS Concomitant_Disease;
VAR Freq;
OUTPUT OUT=Count SUM=Freq;
RUN;