%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 */ quit;
I am so sorry for posting partial data in my earlier mail,plsconsider that let me know why first and second options are not working.
... View more