In SAS Enterprise Guide, I'm trying to create a calculated column that converts a date (in the DATETIME26.6 format) to a date format fiscal month. If the day is the 1st through the 21st of the month, I want the fiscal month to be the first day of that month. If the day is the 22nd through the 31st of the month, I want the fiscal month to be the first day of THE NEXT month As an example, Jan 21st 2019 should return Jan 1st 2019 And Jan 22nd 2019 should return Feb 1st 2019 I've written the code and tested both the INTNX and comparison in pieces (and they've worked), but when I include it in a case statement, my returns are all coming out as '." Or analogously, if there's a better way of doing this, I'm happy to adopt a new solution altogether! CASE
WHEN DAY(DATEPART(t3.CRE_DT))<22
THEN
INTNX( 'DAY',
t3.CRE_DT,
1-DAY(DATEPART(t3.CRE_DT))
)
WHEN DAY(DATEPART(t3.CRE_DT))>=22
THEN
INTNX( 'MONTH',
INTNX( 'DAY', DATEPART(t3.CRE_DT), 1-DAY(DATEPART(t3.CRE_DT)),
1
)
END
... View more