Hello everyone,
I am new to SAS Enterpride Guide and programming in general but have been picking up things quickly and I can't seem to resolve this problem, so I am hoping someone can help me with this.
Basically what's happening is that the way there is a process flow set for a weekly report that has a rank task that will rank the dates in such a way that the rank values are assigned in order of recency. I run this process flow on Mondays for the report and the ranks that I need from the ranked table are only the top 5 ranks. This would be rank 1, the previous Friday, to rank 5, the previous Monday (the table only has business days dates).
However, sometimes there will be dates that will not show up on the table (I know which are the dates that won't show up) and when Monday come and I make my report rather than analyzing the top 5 ranks I only have to use the top 4 ranks. Meaning I would need to only filter from rank 1, previous Thursday (because Friday's date, April 14th, is missing), to rank 4, previous Monday. (attempt at a visual representation below).
The idea is set it up so that Enterpirse Guide will run the process flow and give me the desired end result table because it can recognize when it is a normal week (Rank =< 5, Friday to Monday) and when it is a "special" week (Rank =< 4, Thursday to Monday).
Thank you in advance for the support.
When you need the code to only fetch dates starting with last Monday, use
intnx('week',today(),-1,'b') + 1
as cutoff date.
I like the idea but I haven't been able to implement it correctly in the filter. Could you explain how to use it?
From your description, I think you are massively overcomplicating things, mostly because the pointy-clicky "helpers" in EG get into the way of your thinking.
As I see it, you want a summary report for the days of the last week. To verify this, please post example data in textual form (ideally as a data step with datalines, so we can quickly and reliably recreate your dataset without guessing about variable attributes), and the expected output in readable form (your initial picture is much too small).
Currently the way it's implemented there is a rank task that ranks the dates from 1 (most recent date) to 184 (furthest date). You are suggesting having a table with all the dates that are available and joining that with the base data set or am I misunderstanding you?
Where is the date value that was used to "rank" the dates?
If that variable is in the data set and is date valued, i.e. numeric hopefully created with a proper date informat when reading the data with a date format assigned so people can read it, then filtering would be to use that date variable compared to the value @Kurt_Bremser suggested.
Code would look like
where yourdatevariable ge intnx('week',today(),-1,'b') + 1
if you want the dates from last Monday to present. Could be in a data set option WHERE option or a statement if the procedure you use accepts them (many do).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: