0

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);
  • 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 Nov 14 '16 at 08:09
  • I think you're also confusing macro and datastep code. I think the original code is from here (?) http://www.lexjansen.com/wuss/2005/data_analysis_and_statistics/das_a_macro_mapping_date.pdf A lot of guessing on my part. Not sure where you got the macro from or what you're trying to do. – Reeza Nov 14 '16 at 08:12
  • @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 Nov 15 '16 at 05:30

1 Answers1

0

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

Andy Lamb
  • 2,151
  • 20
  • 22