@BCNAV wrote:
The reason why there is no day value is because these are aggregated monthly counts at air traffic control towers. Only monthly data is required, hence no date field is provided to me of individual flights. I can make one via:
mdy(t1.Month,1,t1.Year) with a format of MMDDYY8.
Now, when I use: intnx('month',t1.date,-2) < datepart(today()); Nothing is returned
The data now looks like:
Airport Date Year Month Count
CYXX 1/1/2018 2018 1 5,091
CYXX 2/1/2018 2018 2 6,148
CYXX 3/1/2018 2018 3 11,069
CYXX 4/1/2018 2018 4 11,359
CYXX 5/1/2018 2018 5 14,552
CYXX 6/1/2018 2018 6 11,333
CYXX 7/1/2018 2018 7 7,842
I only want the last two months ever sent out. As can been seen above, that is June and July.
If I use intnx('month',t1.date,-2) < today(); then everything is returned.
I suspect this is close...
A date value also simplifies addressing the "two previous months" when you are in February and you needed two year/month combinations. or when management comes back and says "what about 3 (or 4 or 5 or …) months previously, or comparing first quarter of this year with first quarter of last year …
TODAY function returns a date value. See:
data _null_;
x=today();
put x date9.;
run;
When you use datepart(today()) you have told SAS to treat Today as datetime value and is way off:
data _null_;
x=datepart(today());
put x date9.;
run;
... View more