楼主: readhistory
3662 14

[原创博文] 频数表,处理缺失类别 [推广有奖]

11
jingju11 发表于 2012-3-10 09:37:56
data new;
set old end =eof;
...;
run;
run;

12
jingju11 发表于 2012-3-10 09:41:03
*with by;
data new;
set old; by bygroup;
count =1;
output;
...weight count; ...; run;

13
jingju11 发表于 2012-3-10 09:42:52
if you want sas to recognize what you have added, you have to use weight variable in proc freq. since weight =0 is allowed in freq. jingju

14
小麦芽的简单 发表于 2012-3-11 22:26:40
我觉得我明白你的意思呵呵
proc format;/*首先要根据你的完整格式定义一个format*/
value level
3="高"
2="中"
1="低"
;
run;
data xx;
format level level.;/*把value给format一下*/
sn=1001;level=3;
output;
sn=1002;level=3;
output;
sn=1003;level=3;
output;
sn=1004;level=2;
output;
sn=1005;level=3;
output;
run;
proc summary data=xx completeTypes;
class level/PRELOADFMT ;/*这两关键词是必须的*/
output out=aa;
run;

最后输出的结果就是:

低  0
中  1
高  4

aa.jpg (6.95 KB)

aa.jpg

15
小麦芽的简单 发表于 2012-3-11 22:31:26
同时proc means过程也能用这个关键词
不过proc freq不能用
不过没关系 可以用proc summary 代替

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-2 03:19