全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1605 2
2010-12-12
%macro nlp (start=,end=,step=,v1=,v2=,out=);
%let w1=&v1.;
%let w2=&v2.;
%let i=&start.;
%do   %while(&i.<=&end.);
  proc nlp out=_sheet;
     max y;
     PARMS b;
     bounds 0<=b<=1;
     Y1= exp(w1);
     y=y1*w2;
  run;
data temp1;
  set _sheet;
run;
%if &i. = &start. %then %do;/*initialize the date*/
   data &out;
     set temp1;
   run;
%end;
%else %do;
   data &out;
     set &out temp1; /*append more date to result*/
   run;
%end;
%let i=%sysfunc(sum(&i.,&step.));
%end;
%mend nlp;
%nlp (start=0.05,end=20, step=0.5,v1=0.2,v2=0.5,out=result)

但日志报错:请各位给看看,为啥?搞不懂
ERROR: The variable w1 was referenced but not given a value.
ERROR: The variable w2 was referenced but not given a value.
WARNING: Your program statements contain 2 symbols used but not given a value.
NOTE: Initial value of parameter b is set randomly to 0.7902130768.
ERROR: There are references to missing variables when the program code is executed for _OBS_= 1
二维码

扫码加我 拉你入群

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

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

全部回复
2010-12-12 11:13:23
没弄明白你这段代码的目的。只发现其中的w1和w2应改为&w1.和&w2.
还有为什么不直接用&v1 &v2~
二维码

扫码加我 拉你入群

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

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

2010-12-13 05:46:54
目的: v1是从外面给定数值, w1是 Proc nlp要用的变量,之所以分开是为了区分,便于理解。

请高手再给讲下为啥w1前加个&就行了呢?

是啥原理?
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群