0
votes

am working on the study day macro below but it gives an error in the log the program is a reference code as am new to clinical sas i was trying to calculate studyday by accepting 3 columns from 3 tables to be used to calculate the studyday... can u help me with this... requirement... thanks

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 can anyone give a idea on how this statement can be resolved?

%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);
1
Can you post your full code? The macro is intended to be called from within a data step not in open code as you've shown.Reeza
I think you're also confusing macro and datastep code. I think the original code is from here (?) lexjansen.com/wuss/2005/data_analysis_and_statistics/… A lot of guessing on my part. Not sure where you got the macro from or what you're trying to do.Reeza
@Reeza i took the program as reference as am new to clinical sas i was trying to calculate studyday by accepting 3 columns from 3 tables to be used to calculate the studyday... can u help me with this... requirement... thanks.user7108488

1 Answers

0
votes

Length is a macro function, so use '%length' instead of 'length'.