|
Richard,
Try coding %PUT &BEGDATE to see what you have actually created in the
macro variable?
You might find this approach simpler to read (I know I do!):
%let montxt = may;
%let year=2002;
%LET BEGDATE=01&MONTXT.&YEAR;
DATA table;
begloop = "&BEGDATE"d;
endloop = intnx('MONTH',begloop,0,'E');
totrecs=.;
DO rectype=1 to 11;
DO chargedate=begloop to endloop;
DO hour = 0 to 23;
output;
END;
END;
END;
RUN;
Kind regards,
Dave
Richard Paterson asks:
> hi folks,
>
> can someone tell me what is wrong with the following quote. I have
> narrowed it down to the BEGDATE and ENDDATE macro variables, but
> cannot explain why a syntax error is being generated. If I hardcode in
> the date values then it works. any help appreciated.
>
> thanks
>
> Richard
>
>
> %let montxt = may;
> %let year=2002;
>
> %LET next=%eval(%sysfunc(mdy(&month+1,01,&year))-1);
> %LET lastday=%sysfunc(day(&next));
>
> %LET begdate=%STR(%')01-&montxt-&year.%STR(%');
> %LET enddate=%STR(%')&lastday-&montxt-&year.%STR(%');
>
> DATA table;
>
> begloop = input(&begdate,date11.);
> endloop = input(&enddate,date11.);
> * begloop = input('01-may-2002',date11.);
> * endloop = input('31-may-2002',date11.);
> put begloop= ;
> put endloop= ;
> totrecs=.;
> DO rectype=1 to 11;
> DO chargedate=begloop to endloop;
> DO hour = 0 to 23;
> output;
> END;
> END;
> END;
> RUN;
.
|