stata - 识别包含非整数值的变量中的观察值
问题描述
我正在尝试运行statsby
命令,但我不断收到group_id: factor variables may not contain noninteger values; an error occurred when statsby executed regress
错误消息。似乎定义组的变量(即“group_id”)包含非整数值,这会造成麻烦。
如何识别非整数情况以便处理它们?还是有更全面的方法来解决这个问题?
解决方案
* 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()
.
推荐阅读
- javascript - 正则表达式 preg_replace_callback 在 javascript 中转换
- arduino - M600Pro 和 Arduino 之间没有干净的串行通信
- python - 在段落中添加超链接(libreoffice、Google Docs)
- c# - LINQ 查询加入两个集合并过滤结果集
- c++ - 如果我有来自在线摄像头的输入信息,如何保存 AVPacket
- html - 如何复制此布局 HTML
- r - 如何使用 ggplot2 中的功能区工具在两个几何 h_lines 之间填充
- bash - 编写一个 shell 脚本来循环并打印出数字 0-100 以及它们是偶数还是奇数
- jsp - 如何在 Struts 值中连接参数 + 字符串?
- alsa - ALSA 音序器:使用高速 MIDI 避免输入缓冲区溢出