SAS缺失值
我是SAS的新手,正在使用一个处理数字变量“宽度”的数据集。此变量有多个缺失值,显示为“.”,我需要转换这些值,以便它们在结果中显示为“无样本”。如果我只是转换为零,我只需执行以下操作:SAS缺失值,sas,Sas,我是SAS的新手,正在使用一个处理数字变量“宽度”的数据集。此变量有多个缺失值,显示为“.”,我需要转换这些值,以便它们在结果中显示为“无样本”。如果我只是转换为零,我只需执行以下操作: if width=. then do width='0'; 但是因为我需要把它改成一个角色,我不知道该怎么做 谢谢定义一种格式并将其与变量一起使用 proc format ; value nosample .='No Sample' ; run; proc print data=have ;
if width=. then do width='0';
但是因为我需要把它改成一个角色,我不知道该怎么做
谢谢定义一种格式并将其与变量一起使用
proc format ;
value nosample
.='No Sample'
;
run;
proc print data=have ;
format width nosample.;
run;
定义格式并将其与变量一起使用
proc format ;
value nosample
.='No Sample'
;
run;
proc print data=have ;
format width nosample.;
run;
这有帮助吗
DATA testwidth;
INPUT @1 BirthDate DATE11.
@13 Width 8.; *Decimal and integer ages using YRDIF;
FORMAT BirthDate DATE11. width 8.;
DATALINES;
01-MAR-2017 10
02-MAR-2017 9
03-MAR-2017 8
28-MAR-2017 11
30-MAR-2017
02-JUN-2017 6
02-JUL-2017 5
;
data newds (drop=num_width);
length width $12.;
set testwidth(rename=(width=num_width));
if num_width=. then width = 'NO SAMPLE';
else width = num_width;
run;
这有帮助吗
DATA testwidth;
INPUT @1 BirthDate DATE11.
@13 Width 8.; *Decimal and integer ages using YRDIF;
FORMAT BirthDate DATE11. width 8.;
DATALINES;
01-MAR-2017 10
02-MAR-2017 9
03-MAR-2017 8
28-MAR-2017 11
30-MAR-2017
02-JUN-2017 6
02-JUL-2017 5
;
data newds (drop=num_width);
length width $12.;
set testwidth(rename=(width=num_width));
if num_width=. then width = 'NO SAMPLE';
else width = num_width;
run;