【发布时间】:2016-06-18 18:40:37
【问题描述】:
当我不希望它们被删除时,我所有的缺失值都会被删除。我假设 SAS 和 Oracle 表现不佳 - 但我不知道解决方案。感谢您提供有关此错误的任何想法。
观察字符字段 SEX 有缺失值:
data test ;
input name $ sex $ age city $;
if sex = "NA" then sex=' ';
if city = "Unk" then city = ' ';
cards;
Gene M 62 Saginaw
Cyndi F 45 Unk
Alice NA 51 Bay City
Bob M 55 Unk
;
proc print data=test; run;
观察我可以过滤 SEX 并且仍然有缺失值:
proc sql;
create table que1 as
select * from test where sex
not in ('F','M');
quit;
proc sql; select * from que1; quit;
通过 libname 连接观察从 Oracle 表中提取的普通数据:
proc sql;
create table test as
select * from dss.student_registrations
where term_code gt '201500'
and row_type = 'E'
/* and final_grade not in ('AU','WU') */
;quit;
proc freq data=test; tables final_grade / missing; run;
现在我对 final_grade 设置了限制,所有缺失的值都消失了:
proc sql;
create table test as
select * from dss.student_registrations
where term_code gt '201500'
and row_type = 'E'
and final_grade not in ('AU','WU')
;quit;
proc freq data=test; tables final_grade / missing; run;
【问题讨论】:
标签: sas missing-data proc-sql