我可以将有关未初始化变量的注释升级为错误吗 [英] Can I Promote Notes About Uninitialized Variables to Errors
问题描述
当 SAS 遇到未初始化的变量时,它会在日志中输出一条如下所示的注释:
When SAS encounters an uninitialized variable, it will output a note to the log that looks like this:
NOTE: Variable not_in_data is uninitialized.
是否可以让 SAS 将该消息输出为警告或错误?
Is it possible to have SAS output that message as a warning or an error instead?
推荐答案
是(在 9.4 或更高版本中):
Yes (in 9.4 or later):
option varinitchk = error;
默认值为note
,其他可能的值为nonote
和warning
.
Default value is note
, other possible values are nonote
and warning
.
还有一个未记录的功能可以将某些注释更改为错误.您可以使用 option dsoptions = note2err
设置选项;或通过将 /note2err
添加到数据语句中.我在 SAS-L 上找到了此选项更改为错误的注释列表:
There is also undocumented feature that changes certain notes to errors. You can either set the option using option dsoptions = note2err
; or by adding / note2err
to a data statement. I found a list on SAS-L of the notes this option changes to errors:
19 Variable %*v is uninitialized.
97 Missing values were generated as a result of
98 Division by zero detected at %2q.
99 Mathematical operations could not be performed
108 Invalid numeric data, '%*s' , at %2q.
109 Invalid character data, %f , at %2q.
110 Invalid %sargument to function %b at %2q.
139 Argument to function %*s is not a known variable name: %*v.
140 Argument to function %*s is not a valid variable name: %*s.
205 Invalid argument(s) to the exponential operator "**" at %2q.
208 Invalid numeric data, %*s='%*s' , at %2q.
209 Invalid character data, %*s=%f , at %2q.
223 A number has become too large at %2q. %w%*s
224 A number has become too large during the compilation phase.
225 Division by zero detected during the compilation phase.
242 Invalid argument(s) to the exponential operator "**".
258 Invalid argument to function %*b at %2q.
259 Invalid first argument to function %*b at %2q.
260 Invalid second argument to function %*b at %2q.
261 Invalid third argument to function %*b at %2q.
262 Invalid fourth argument to function %*b at %2q.
267 Argument %d to function %*b at %2q is invalid.
356 The SUBSTR pseudo-variable function does not allow character
424 Character values have been converted to numeric
425 Numeric values have been converted to character
429 A number has become too large during the compilation phase,
430 Division by zero detected during the compilation phase,
484 Format %*b was not found or could not be loaded.
485 Informat %*b was not found or could not be loaded.
这篇关于我可以将有关未初始化变量的注释升级为错误吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!