我正在研究下面的研究日宏,但它在日志中出错 该程序是一个参考代码,因为我是临床sas的新手,我试图通过接受3个表中的3列用于计算studyday来计算studyday ...你可以帮我这个...要求...谢谢< / p>
SYMBOLGEN: Macro variable ENDC resolves to aestdtc
SYMBOLGEN: Macro variable ENDC resolves to aestdtc
ERROR: Required operator not found in expression: length(&endc)=10
ERROR: The macro STDYDATES will stop executing.
PLZ任何人都可以就如何解决这个陈述提出想法吗?
%macro stdydates(studyday=, endc=, refdate=);
%if &endc= '' %then &studyday=.;
%else %do;
%if length(&endc)=10 %then %do;
%if input(substr(&endc,1,10),yymmdd10.) < input(substr(&refdate,1,10),yymmdd10.)
%then &studyday=input(substr(&endc,1,10), yymmdd10.) -
input(substr(&refdate,1,10), yymmdd10.);
%else &studyday=input(substr(&endc,1,10), yymmdd10.) -
input(substr(&refdate,1,10), yymmdd10.) + 1;
%end;
%else %if length(&endc)=8 %then %do;
%if input(&endc, yymmdd8.)<input(substr(&refdate,1,10), yymmdd10.)
%then &studyday=input(&endc, yymmdd8.) - input(substr(&refdate,1,10),yymmdd10.);
%else &studyday=input(&endc, yymmdd8.) - input(substr(&refdate,1,10), yymmdd10.)+1;
%end;
%end;
%mend stdydates;
options mprint symbolgen;
%stdydates(studyday=ST,endc=aestdtc, refdate=rfstdtc);
答案 0 :(得分:0)
长度是一个宏函数,因此请使用'%length'而不是'length'。