替换 SAS 中的缺失值 [英] Replace missing values in SAS
本文介绍了替换 SAS 中的缺失值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 SAS 中用零替换所有缺失值?我有一个文本文件,我将其转储到 SAS 中以处理一些地理数据,但只要它有缺失值,它就会中断操作.有没有办法在不指定每个字段的情况下更改它?我有200多个.
How do you replace all missing values with zeroes in SAS? I have a text file that I dump into SAS to process some geo data, but whenever it has a missing value it breaks the operations. Is there a way to change this without specifying each field? I have over 200.
我这样做的方式是:
data geo_cali_north;
set geo_cali_north;
if polar_data eq . then 0;
if lat_xvar eq . then 0;
run;
如何避免对每个字段都这样做?
How can I avoid doing this for every field?
推荐答案
您可以像这样将所有缺失值设置为 0:
You can set all the missing values to 0 with like this:
data myData;
set myData;
array a(*) _numeric_;
do i=1 to dim(a);
if a(i) = . then a(i) = 0;
end;
drop i;
这将转换任何数字."到 0
This will convert any numeric "." to a 0
这篇关于替换 SAS 中的缺失值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文