10-03-2016 10:16 AM
I am trying to create a MTD flad on SAS EG to compare financial figures year over year; below is the formula I came up with, however I am not getting any answers. Not sure, what I'm doing wrong here:
WHEN MONTH(t1.TransactionDate) = MONTH (TODAY()) AND DAY(t1.TransactionDate) <= DAY(TODAY())
I have a list of TransactionsDates for 2015 (Jan to Dec) and 2016 YTD.
10-03-2016 10:29 AM
data have; input transactiondate :yymmdd10.; format transactiondate yymmddd10.; cards; 2015-04-04 2015-10-02 2015-10-10 2016-04-04 2016-10-02 2016-10-10 ; run; proc sql; create table want as select transactiondate, case when month(t1.TransactionDate) = month(today()) and day(t1.TransactionDate) <= day(today()) then 'MTD' end as mtd from have t1; quit; proc print noobs; run;
delivers this result:
transactiondate mtd 2015-04-04 2015-10-02 MTD 2015-10-10 2016-04-04 2016-10-02 MTD 2016-10-10
So to me, your query works as desired; if that is not the case with your code, post the complete SQL code and the log.
Need further help from the community? Please ask a new question.