|
5#
楼主 |
发表于 2004-4-16 10:57:35
|
只看该作者
请教时间变量二次引用问题,在SQL中第二次引用时怎样定义?
[b:0e06c]%macro day_to_str;
data daytostring;
yesd=today()-21;
format yesd DATE9.;
run;
***************************;
%Day_to_Week(in=daytostring,var=yesd,out=daytostring);
***************************;[/b:0e06c][b:0e06c]data _NULL_;
set daytostring;
call symput('daystr',put(yesd,DATE9.));
call symput('week',put(week,BEST3.));
run;[/b:0e06c]
[b:0e06c]%mend day_to_str;
%day_to_str;
[/b:0e06c]
*****************************************************************************************;
[b:0e06c]Data YLD_pm_daily;
set webdata.Pm_anad_base;
where Date>='&daystr'd and Operation='TTL' and HTNUM^=900;
count=QTY*Flip_rate/100;
run;[/b:0e06c]
RUN时报错: +*****************************************************************************************;
102 +Data YLD_pm_daily;
103 + set webdata.Pm_anad_base;
104 + where Date>='&daystr'd and Operation='TTL' and HTNUM^=900;
[color=red:0e06c]ERROR: Invalid date/time/datetime constant '&daystr'd.
ERROR: Syntax error while parsing WHERE clause.[/color:0e06c]
105 + count=QTY*Flip_rate/100;
106 +run;
请教在where Date>='&daystr'd 处怎样定义它(一定要用到daystr的值),好象SAS不认识'&daystr'd,无法再次翻译'&daystr'd。
请各位高手赐教,小弟在此谢谢大家了!! |
|