楼主: ransuoqu
3782 6

[有偿编程] 大神看看我的代码问题出现在哪里 [推广有奖]

  • 1关注
  • 0粉丝

大专生

63%

还不是VIP/贵宾

-

威望
0
论坛币
1 个
通用积分
0.0002
学术水平
1 点
热心指数
1 点
信用等级
0 点
经验
609 点
帖子
27
精华
0
在线时间
84 小时
注册时间
2015-6-5
最后登录
2020-5-12

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
总是提示where 子句运算符要求兼容的变量,我做的是一个10-fold cross- validation 交叉验证,因变量是字符型,自变量是数字,
  1. %macro xval(dsn=,outcome=,covars=,k=10,sel=stepwise,outdsn=_xval_,outdsn2=comparison);

  2. data _modif;
  3.   set &dsn;
  4.   unif=&k*ranuni(20052905);
  5.   xv=ceil(unif);
  6. run;

  7. %do i=1 %to &k;
  8.   proc logistic data=_modif(where=(xv ne &i)) outmodel=_mod&i;
  9.   model &outcome (event="1") =&covars / selection=&sel;
  10.   ods output association=assoc&i;
  11.   run;
  12. %if print^=0 %then %do;proc printto file='junk.txt';%end;
  13.   proc logistic inmodel=_mod&i;
  14.   score data=_modif(where=(xv=&i)) out=out&i;
  15.   run;

  16. ods select none;
  17. ods output KolSmir2Stats=KS&i;
  18. proc npar1way data= out&i edf;
  19. where &outcome^=.;
  20. class &outcome;
  21. var  P_1;
  22. run;
  23. ods select all;

  24. ods select none;
  25. ods output WilcoxonScores=Wil&i;
  26. proc npar1way wilcoxon data= out&i;
  27. where &outcome^=.;
  28. class &outcome;
  29. var  P_1;
  30. run;
  31. ods select all;

  32. data AUC&i;
  33. set Wil&i end=eof;
  34. retain v1 v2 1;
  35. if _n_=1 then v1=abs(ExpectedSum - SumOfScores);
  36. v2=N*v2;
  37. if eof then do;
  38. d=v1/v2;
  39. /*Gini=d * 2; */
  40. Scoring_AUC= d + 0.5;
  41. put Scoring_AUC=;
  42. put "****Open work.results dataset to see results of training datasets....";
  43. keep Scoring_AUC;
  44. output;
  45. end;
  46. run;

  47. %if print^=0 %then %do;proc printto;run;%end;
  48. %end;
  49. data &outdsn;
  50. set %do j=1 %to &k;out&j %end;;
  51. run;

  52. data training (keep =label2 nvalue2 rename= (nvalue2=Training_AUC));
  53. set %do j=1 %to &k;assoc&j %end;;
  54. where label2= 'c';
  55. if label2='c' then label2 ='AUC';
  56. run;

  57. data ks (keep =label2 nvalue2 rename= (nvalue2=Scoring_KS));
  58. set %do j=1 %to &k;ks&j %end;;
  59. where label2= 'D';
  60. if label2='D' then label2 ='KS';
  61. run;

  62. data validation;
  63. set %do j=1 %to &k;AUC&j %end;;
  64. run;

  65. data &outdsn2 (drop = label2);
  66. merge training validation ks;
  67. run;

  68. ods select none;
  69. ods output WilcoxonScores=WilcoxonScore;
  70. proc npar1way wilcoxon data= &outdsn;
  71. where &outcome^=.;
  72. class &outcome;
  73. var  P_1;
  74. run;
  75. ods select all;

  76. data AUC;
  77. set WilcoxonScore end=eof;
  78. retain v1 v2 1;
  79. if _n_=1 then v1=abs(ExpectedSum - SumOfScores);
  80. v2=N*v2;
  81. if eof then do;
  82. d=v1/v2;
  83. Gini=d * 2;
  84. AUC= d + 0.5;
  85. put AUC=  GINI=;
  86. put "****Open work.results dataset to see results of training datasets....";
  87. keep AUC Gini;
  88. output;
  89. end;
  90. run;

  91. %mend;

  92. %xval(dsn=data,outcome=var_13,covars= t569 t868 t725 t291 t323,k=10,sel=stepwise, outdsn=kfold, outdsn2=comparison);
复制代码

二维码

扫码加我 拉你入群

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

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

关键词:运算符

沙发
learsaas 发表于 2018-6-29 14:06:38 |只看作者 |坛友微信交流群
日志报错的地方贴出来

使用道具

藤椅
ransuoqu 发表于 2018-6-29 16:59:28 |只看作者 |坛友微信交流群
learsaas 发表于 2018-6-29 14:06
日志报错的地方贴出来
我已经解决了,谢谢。


1530262685(1).png (114.68 KB)

1530262685(1).png

DATA.xls

15.23 KB

使用道具

板凳
ransuoqu 发表于 2018-6-29 22:08:59 |只看作者 |坛友微信交流群
我自己已经解决了

使用道具

报纸
learsaas 发表于 2018-7-2 13:20:08 |只看作者 |坛友微信交流群
非常好,good!

使用道具

地板
倾辰苑落 发表于 2019-6-17 20:50:06 |只看作者 |坛友微信交流群
ransuoqu 发表于 2018-6-29 22:08
我自己已经解决了
请问怎么解决的

使用道具

7
倾辰苑落 发表于 2019-6-17 20:50:10 |只看作者 |坛友微信交流群
ransuoqu 发表于 2018-6-29 22:08
我自己已经解决了
请问怎么解决的

使用道具

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

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

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

GMT+8, 2024-4-25 07:45