在SAS中是否有一种识别proc格式中特殊缺失值的方法?
我有一些类似于下面的代码:在SAS中是否有一种识别proc格式中特殊缺失值的方法?,sas,format,missing-data,Sas,Format,Missing Data,我有一些类似于下面的代码: proc format; ** for numeric variables; value missf . = ‘Missing’ other = ‘Non-Missing’ ; ** for character variables; value $missf ‘ ‘ = ‘Missing’ other = ‘Non-Missing’ ; run; proc freq data=rawds; table _all_ / missing;
proc format;
** for numeric variables;
value missf
. = ‘Missing’
other = ‘Non-Missing’
;
** for character variables;
value $missf
‘ ‘ = ‘Missing’
other = ‘Non-Missing’
;
run;
proc freq data=rawds;
table _all_ / missing;
format _character_ $missf. _numeric_ missf.;
run;
如您所见,我们有用于数值的格式missf。但是,我的数据有一些特殊的缺失值.A、.B、.C等,这些值目前没有被标记为缺失,因为格式missf只查找
我知道我可以在proc格式中添加更多的行,例如,执行类似的操作,但感觉效率低下:
. = 'Missing'
.a = 'Missing'
.b = 'Missing'
.c = 'Missing'
...
.A = 'Missing'
...
.Z = 'Missing'
有没有一种方法可以添加特殊的缺失值,而不必写52行代码26个小写字母,26个大写字母?缺失值有顺序。u是最小的,然后是常规缺失,,,然后是.a到.Z 或者,您可以使用LOW-HIGH range来捕获非缺失值,另一种情况下捕获缺失值
value missf low-high='Non-missing' other='Missing';
谢谢对于任何其他想知道的人来说,一个常规的“.”也按缺失的值顺序计算。所以我所做的只是替换掉了missf的值Missing'with value missf.-.z='Missing',它工作正常。
value missf low-high='Non-missing' other='Missing';