楼主: webgu
1200 5

[问答] 奇怪的99.2% [推广有奖]

贵宾

学科带头人

95%

还不是VIP/贵宾

-

TA的文库  其他...

Python与统计

SAS与统计

威望
2
论坛币
102554 个
通用积分
3.6187
学术水平
475 点
热心指数
493 点
信用等级
434 点
经验
62375 点
帖子
1557
精华
4
在线时间
2201 小时
注册时间
2009-5-4
最后登录
2024-4-23

初级学术勋章 初级热心勋章 初级信用勋章 中级学术勋章 中级热心勋章 中级信用勋章

50论坛币
今天调试程序,每次出来的宏变量都是 99.2%,很奇怪。大家帮忙看一下。

我的数据集:




我的程序:

2.jpg

我的结果竟然是 99.2%,不是100%?
3.jpg

请问各位是什么原因?

1.jpg (8.77 KB)

1.jpg

最佳答案

邓贵大 查看完整内容

Easy bucks. The second argument of your round function is 3.1, so it returns a multiple of 3.1, which happens to be 99.2, because that is as close as you can get from 100.
关键词:是什么原因 数据集 程序
SAS资源
1. SAS 微信:StatsThinking
2. SAS QQ群:348941365
沙发
邓贵大 发表于 2013-11-2 22:13:01 |只看作者 |坛友微信交流群
Easy bucks. The second argument of your round function is 3.1, so it returns a multiple of 3.1, which happens to be 99.2, because that is as close as you can get from 100.
已有 3 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
webgu + 100 + 100 + 1 + 1 + 1 精彩帖子
zhou.wen + 1 对round函数理解不够深啊..
pobel + 3 + 3 + 3 分析的有道理

总评分: 经验 + 100  论坛币 + 100  学术水平 + 5  热心指数 + 4  信用等级 + 4   查看全部评分

Be still, my soul: the hour is hastening on
When we shall be forever with the Lord.
When disappointment, grief and fear are gone,
Sorrow forgot, love's purest joys restored.

使用道具

藤椅
juliewong 在职认证  发表于 2013-11-2 22:26:24 |只看作者 |坛友微信交流群
这是啥程序,帮顶
已有 1 人评分热心指数 收起 理由
webgu + 3 热心帮助其他会员

总评分: 热心指数 + 3   查看全部评分

使用道具

板凳
bobguy 发表于 2013-11-3 02:10:39 |只看作者 |坛友微信交流群
The case I can think of is that you have customized formats like the example below,

proc format;
value pct
0-<99 = best.
99-100=100
;
run;

data t1;
  colpercent=99.2;
  call symputx('pct',colpercent);
  format colpercent pct.;
  run;

  proc print;run;

  %put >>>&pct<<<;

do a proc contents and take a look there is a format for  the variable.
已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
webgu + 60 + 60 + 1 + 1 + 1 热心帮助其他会员

总评分: 经验 + 60  论坛币 + 60  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

报纸
Imasasor 发表于 2013-11-3 20:56:58 |只看作者 |坛友微信交流群
你把你的数据集上传上来才比较方便看原因吧,因为显示的100可能是99.2
已有 1 人评分经验 论坛币 收起 理由
webgu + 20 + 20 热心帮助其他会员

总评分: 经验 + 20  论坛币 + 20   查看全部评分

欢迎加入亚太地区第一R&Python数据挖掘群: 251548215;

使用道具

地板
webgu 发表于 2013-11-4 08:05:11 |只看作者 |坛友微信交流群
邓贵大 发表于 2013-11-2 22:13
Easy bucks. The second argument of your round function is 3.1, so it returns a multiple of 3.1, whic ...
确实问题在此.
整数ROUND时要小心.
SAS资源
1. SAS 微信:StatsThinking
2. SAS QQ群:348941365

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-26 12:28