我正在尝试运行statsby
命令,但不断收到group_id: factor variables may not contain noninteger values; an error occurred when statsby executed regress
错误。似乎定义组的变量(即“ group_id”)包含非整数值,这会引起麻烦。
我该如何识别非整数案例以便处理它们?还是对此有更全面的方法?
答案 0 :(得分:2)
* Example generated by -dataex-. To install: ssc install dataex
clear
input float test
1
2
3.1
4
5
end
tab test if test != round(test, 1)
test | Freq. Percent Cum.
------------+-----------------------------------
3.1 | 1 100.00 100.00
------------+-----------------------------------
Total | 1 100.00
其他类似的解决方案可以使用int()
,floor()
或ceil()
。