BookmarkSubscribeRSS Feed
Boombox
Calcite | Level 5

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).

 

Boombox_0-1679867299685.png

 

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. 

6 REPLIES 6
Boombox
Calcite | Level 5

I like the idea but I haven't been able to implement it correctly in the filter. Could you explain how to use it?

Kurt_Bremser
Super User

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).

LinusH
Tourmaline | Level 20
I don't see how you implemented the current functionality.
But it sounds like you could use some kind of calendar data set which you could use for look-up which in turn is taking into account for your ranking logic code.
Data never sleeps
Boombox
Calcite | Level 5

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?

ballardw
Super User

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).

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1357 views
  • 0 likes
  • 4 in conversation