我可以将关于未初始化变量的注释提升为错误 [英] Can I Promote Notes About Uninitialized Variables to Errors

查看:322
本文介绍了我可以将关于未初始化变量的注释提升为错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 当SAS遇到未初始化的变量时,它会向日志输出一个注释: not_in_data未初始化。 

可否将SAS输出该消息作为警告或错误?

解决方案

是(9.4或更高版本):



选项varinitchk = error;



默认值为 note ,其他可能的值为 nonote 警告



还有未记录的功能将某些注释更改为错误。您可以使用选项设置选项dsoptions = note2err ;或者通过向数据语句添加 / note2err 。我在SAS-L上找到了一个列表,该选项更改为错误:

  19变量%* v未初始化。 
97由于
98产生了缺失值,因此在%2q处检测到零。
99无法执行数学运算
108%2q上的无效数字数据'%* s'。
109无效的字符数据%f,在%2q。
110%2在%2q上的函数%b无效。
139函数%* s的参数不是已知的变量名:%* v。
140函数%* s的参数不是有效的变量名:%* s。
205%2q上指数运算符**的参数无效。
208无效的数字数据,%* s ='%* s',在%2q。
209无效的字符数据,%* s =%f,在%2q。
223%2q的数字已经变得太大了。 %w%* s
224在编译阶段,一个数字变得太大。
225在编译阶段检测到零除。
242指数运算符**的参数无效。
258%2q上的函数%* b的参数无效。
259%2q上函数%* b的第一个参数无效。
260%2q上函数%* b的第二个参数无效。
261%2q上函数%* b的第三个参数无效。
262%2q上函数%* b的第四个参数无效。
267%2在函数%* b的参数%d无效。
356 SUBSTR伪变量函数不允许字符
424字符值已转换为数字
425数值已转换为字符
429数字变得太大在编译阶段,
430在编译阶段检测到零,
484格式%* b未找到或无法加载。
485信息%* b未找到或无法加载。

来源


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.

Is it possible to have SAS output that message as a warning or an error instead?

解决方案

Yes (in 9.4 or later):

option varinitchk = error;

Default value is note, other possible values are nonote and warning.

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.

Source

这篇关于我可以将关于未初始化变量的注释提升为错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆