BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
EIrvin
Fluorite | Level 6

HELP!!! I am having difficulty creating set it and forget it reporting.  I have a transaction table that contains posting dates mm/dd/yy.  and in comparision with previous day reporting today()-1.  I need to continuously be able to pull current month to date, previous month to date, prior year month to date, current quarter to date, prior quarter to date, etc.  All of this without having to go into my report daily and hardcode the dates I am looking for.

 

What I have tried thus far, which worked for the month of March, but not since then is

current date = today()-1   since our flat files are from yesterday!  Then i have this date broken down in to Yr, Qtr, Mon, Day

Prior Month date = today()-31  which doesn't necessarily work for the month roll over or for February since its a shorter month

Prior Year Month date = today()-366 for this year only, broken this out in to Yr, Qtr, Mon, Day

 

then to put beside my transactions

for current day  = case when (t1.'CURRENT DATE DAY'n = t1.'POST DATE DAY'n) and  (t1.'CD MONTH'n = t1.'POST DATE MONTH'n) and (t1.'CD YEAR'n = t1.'POST DATE YEAR'n) then 'CD' else '' end

 

for MTD = CASE WHEN (( t1.'CD YEAR'n =t1.'POST DATE YEAR'n) AND t1.'CD MONTH'n = t1.'POST DATE MONTH'n) THEN 'MTD' ELSE '' END

 

for PMTD =CASE WHEN (( t1.'PMTD YEAR'n =t1.'POST DATE YEAR'n) AND ( t1.'PMTD MONTH'n = t1.'POST DATE MONTH'n)) THEN 'PMTD' ELSE '' END

 

etc, etc. 

 

and it just didn't work.... If anyone has any workable and tested solutions, I would be grateful if you would share.

 

Thanks in advance

 

El

1 ACCEPTED SOLUTION

Accepted Solutions
Haikuo
Onyx | Level 15

Check INTNX FUNCTION and INTCK Function, it should tackle most of your issues.

View solution in original post

1 REPLY 1
Haikuo
Onyx | Level 15

Check INTNX FUNCTION and INTCK Function, it should tackle most of your issues.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 833 views
  • 0 likes
  • 2 in conversation