Hi there.
I have a data set where the dates are stored as character so i use a substring to retrieve the data
Where = (substr(CaseCreatedDateTime,1,7) in ("2018-09","2018-08")));
The dates need to change each month to the current month and previous month so i'm trying to teach myself to do it in a macro.
data test;
format Temp_TM Temp_LM DDMMYY10.;
Temp_TM=Today();
Temp_LM=intnx('month',Temp_TM,-1,'b');
month=put(month(Temp_TM),z2.);
ThisMonth1=cat((Year(Temp_TM)),"-",(put(Month(Temp_TM),z2.)));
LastMonth1=cat((Year(Temp_LM)),"-",(put(Month(Temp_LM),z2.)));
run;
which gives me two variables with the year and month in in the format above however when i try to reference them sas is seeing it as numeric so it wont work.
Where = (substr(CaseCreatedDateTime,1,7) in (&This_Month,&Last_Month);
i think i need to add quotes around the dates in the macro but am struggling to do it.
Any help greatly appreciated.
Stret
... View more