楼主: suly
5690 3

还是winsorize.谢谢各位 [推广有奖]

  • 0关注
  • 0粉丝

博士生

19%

还不是VIP/贵宾

-

威望
0
论坛币
996 个
通用积分
0.0700
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
4210 点
帖子
157
精华
0
在线时间
209 小时
注册时间
2007-12-20
最后登录
2020-5-3

楼主
suly 发表于 2010-8-1 13:30:29 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
我刚开始没有加这么多变量,运行的很好,可是多winsorize了三了变量就这样了,怎么回事呢,大于小于号有什么问题吗,都是英文状态下输入的。

554  proc sql;
555     create table a_winsorize as select port3.stkcd,port3.ar,port3.year1,
556     case
557     when(e<e_p1) then e_p1
558     when(e>e_p99)  then e_p99
559     else e
560     end as e,
561     case
562     when(c<c_p1) then c_p1
563     when(c>c_p99)  then c_p99
564     else c
565     end as c,
566     case
567     when(tacc<tacc_p1) then tacc_p1
568     when(tacc>tacc_p99)  then tacc_p99
569     else tacc
570     end as tacc,
571     case
572     when(le<le_p1) then le_p1
573     when(le>le_p99)  then le_p99
574     else le
575     end as le,
576     case
577     when(lc<lc_p1) then lc_p1
578     when(lc>lc_p99)  then lc_p99
579     else lc
580     end as lc,
581     case
582     when(ltacc<ltacc_p1) then ltacc_p1
583     when(ltacc>ltacc_p99)  then ltacc_p99
584     else ltacc
585     end as ltacc
586     from port3, a_quant;
ERROR: Expression using less than  (<) has components that are of different data types.
ERROR: Expression using greater than (>) has components that are of different data types.
ERROR: Result of WHEN clause 3 is not the same data type as the preceding results.
ERROR: Expression using less than  (<) has components that are of different data types.
ERROR: Expression using greater than (>) has components that are of different data types.
ERROR: Result of WHEN clause 3 is not the same data type as the preceding results.
ERROR: Expression using less than  (<) has components that are of different data types.
ERROR: Expression using greater than (>) has components that are of different data types.
ERROR: Result of WHEN clause 3 is not the same data type as the preceding results.
ERROR: The following columns were not found in the contributing tables: lc_p1, lc_p99, le_p1, le_p99,
       ltacc_p1, ltacc_p99.
587     quit;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Winsorize winsor wins SOR Win Winsorize

沙发
yatming 发表于 2010-8-1 14:36:17
三个错误:
1。case when中用来做比较的变量类型不同,请楼主检查是否一个是字符型,一个是数值型,注:proc sql做判断时不比data step,值为数值的字符型变量做运算时不会做自动转换。因此请确保逻辑运算的双方都为同类型变量。

2。case when子句3,即else后的结果字段类型与之前的then后的结果字段类型不符,即满足不同条件输出的结果不为同类型,这是不允许的,一个字段只能有一种类型。

3。某些变量在原表中不存在。
已有 1 人评分论坛币 收起 理由
eijuhz + 100 热心回答他人疑问

总评分: 论坛币 + 100   查看全部评分

藤椅
suly 发表于 2010-8-1 20:00:19
626  proc univariate data=port3 ;
627     var  e c tacc lc ltacc le;
628     output out=a_quant p1=c_p1 tacc_p1 e_p1 lc_p1 ltacc_p1 le_p1 p99=c_p99 tacc_p99 e_p99 lc_p99
628! ltacc_p99 le_p99;
629  run;

NOTE: The data set WORK.A_QUANT has 1 observations and 12 variables.
NOTE: PROCEDURE UNIVARIATE used:
      real time           0.39 seconds
      cpu time            0.15 seconds


630  proc sql;
631     create table a_winsorize as select port3.stkcd,port3.ar,port3.year1,
632     case
633     when(e<e_p1) then e_p1
634     when(e>e_p99)  then e_p99
635     else e
636     end as e,
637     case
638     when(c<c_p1) then c_p1
639     when(c>c_p99)  then c_p99
640     else c
641     end as c,
642     case
643     when(tacc<tacc_p1) then tacc_p1
644     when(tacc>tacc_p99)  then tacc_p99
645     else tacc
646     end as tacc,
647     case
648     when(le<le_p1) then le_p1
649     when(le>le_p99)  then le_p99
650     else le
651     end as le,
652     case
653     when(lc<lc_p1) then lc_p1
654     when(lc>lc_p99)  then lc_p99
655     else lc
656     end as lc,
657     case
658     when(ltacc<ltacc_p1) then ltacc_p1
659     when(ltacc>ltacc_p99)  then ltacc_p99
660     else ltacc
661     end as ltacc
662     from port3, a_quant;
NOTE: The execution of this query involves performing one or more Cartesian product joins that can      not be optimized.
NOTE: Table WORK.A_WINSORIZE created, with 13252 rows and 9 columns.
  quit;
NOTE: PROCEDURE SQL used:
      real time           0.07 seconds
      cpu time            0.03 seconds
我修改了下前面,不知这算
NOTE: The execution of this query involves performing one or more Cartesian product joins that can      not be optimized.
NOTE: Table WORK.A_WINSORIZE created, with 13252 rows and 9 columns.
  这句提示是什么意思啊

板凳
BraveMadMan 发表于 2010-8-1 21:25:37
为什么不用那个macro了?
Don't get lost in technical details. What is the big picture?

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-27 06:55