由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 召唤!向大家请教1个sas 问题
相关主题
proc sql count(distinct XX) and count (unique xx)SAS问题请教
Import excel file to sas (the first 8 or more observationsSAS问题再请教
help for sas program问个sas问题
请教一sas programmm一个SAS问题,合并行
请教 SAS macro function 的问题弱问一个data clean的问题,求各位指点。
overall mean in sas for several variables急问一个SAS 的常见问题
如何把一个variable中missing 的observation 付上非missing observation 的valueHelp on a SAS question
还有个问题,如何将一条记录变为空值。[合集] 说一个proc sort的很简单却总有人错的问题
相关话题的讨论汇总
话题: 代码话题: date话题: sas话题: 结果话题: divevents
进入Statistics版参与讨论
1 (共1页)
l*********g
发帖数: 177
1
先上2个代码
代码1:
proc sql;
create table temp1
as select distinct a.permno, b.*
from DivEvents a, caldates b
where b.evt_date-a.date =0
;
quit;
代码2:
proc sql;
create table temp1
as select distinct a.permno, b.*
from DivEvents a, caldates b
where b.evt_date=a.date
;
quit;
按我的理解,这2个代码照理应该是得到同样的结果。但是我发现结果居然极为不同,
其中代码1只生成了6000个observation,而代码2生成了210000个observation。代码2
是我要的结果,但是我不明白为什么代码1会有不同结果,我开始担心我是否其他code
里有出现相关的bug了。请大家指点一下怎么回事把?为什么不同结果呢?非常谢谢!
xi
发帖数: 1678
2
missing value?

【在 l*********g 的大作中提到】
: 先上2个代码
: 代码1:
: proc sql;
: create table temp1
: as select distinct a.permno, b.*
: from DivEvents a, caldates b
: where b.evt_date-a.date =0
: ;
: quit;
: 代码2:

l*********g
发帖数: 177
3
没有哦,2个dataset的column date 或 evt_date 都是没有missing values的哦。

【在 xi 的大作中提到】
: missing value?
d******9
发帖数: 404
4
Since date is numeric value, SAS stores numeric values and do numeric
calculations in floating point way, therefore X=Y, and X-Y=0 may give
different results.
This is probably the reason.
To test it: try to use the below modified condition
where round(b.evt_date-a.date, 1.) =0
l*********g
发帖数: 177
5
确实是这个问题哦!非常感谢 └(^o^)┘

【在 d******9 的大作中提到】
: Since date is numeric value, SAS stores numeric values and do numeric
: calculations in floating point way, therefore X=Y, and X-Y=0 may give
: different results.
: This is probably the reason.
: To test it: try to use the below modified condition
: where round(b.evt_date-a.date, 1.) =0

1 (共1页)
进入Statistics版参与讨论
相关主题
[合集] 说一个proc sort的很简单却总有人错的问题请教 SAS macro function 的问题
Help! proc sql;cout not null value.overall mean in sas for several variables
如何删除重复的OBS?如何把一个variable中missing 的observation 付上非missing observation 的value
请教proc sql还有个问题,如何将一条记录变为空值。
proc sql count(distinct XX) and count (unique xx)SAS问题请教
Import excel file to sas (the first 8 or more observationsSAS问题再请教
help for sas program问个sas问题
请教一sas programmm一个SAS问题,合并行
相关话题的讨论汇总
话题: 代码话题: date话题: sas话题: 结果话题: divevents