SAS中文论坛

标题: 求助如何构造有缺失数据的数据集 [打印本页]

作者: shiyiming    时间: 2008-11-13 11:17
标题: 求助如何构造有缺失数据的数据集
我现在有一个完整的数据集,想通过编程,实现对该完整数据集构造具有不同缺失率(比如10%、20%)的随机缺失数据集,请问如何编程实现呢?
作者: shiyiming    时间: 2012-8-2 17:42
标题: Re: 求助如何构造有缺失数据的数据集
[code:3oie9llr]
data ads;
do i=1 to 100;
   j=2*i;
   output;
end;
run;

proc surveyselect data=ads
  method =srs
  rep=1
  sampsize=10
  seed=12345
  out=bds;
  id i;
run;

proc sql noprint;

create table cds as
select *
from ads
where i not in
(select i from bds);

quit;

data bds;
set bds;
j=.;
run;

data dds;
set cds bds;
run;

data eds;
set dds;
drop i;
run;

[/code:3oie9llr]




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