this is similar to my previous code but no one replied after edit my post.
how to avoid hardcoding d in this "&pre_first_date."d
%let pre_first_date = %str(%')%sysfunc(putn(%sysfunc(intnx(month, %sysfunc(today()), -1, begin)), date9.))%str(%'); %let pre_last_date = %str(%')%sysfunc(putn(%sysfunc(intnx(month, %sysfunc(today()), -1, end)), date9.))%str(%'); %let d_pre_first_date =%str(%')%sysfunc(putn(%sysfunc(intnx(month,%sysfunc(today()),-1)),date9.))%str(%')d; %let d_pre_last_date =%str(%')%sysfunc(putn(%sysfunc(intnx(month,%sysfunc(today()),-1,end)),date9.))%str(%')d; %put &pre_first_date &d_pre_last_date; proc sql; create table xxx as select zz from mytablexxx /* option1 where po_date between &d_pre_first_date and &d_pre_last_date;--not working*/ /*option2 where po_date between "&d_pre_first_date." and "&d_pre_last_date.";ERROR: Expression using IN has components that are of different data types.*/ where po_date between "&pre_first_date."d and "&pre_last_date."d;/* working fine but how can i avoid hardcoding d here */ quit;
... View more