Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Calculate number of weekdays between two days

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Calculate number of weekdays between two days

Hi all,

 

I am looking for a way to find the number of weekdays between the first day of the month and a given date.

I've calculated the number of days like in the screenshot, but I can't find a way to take only weekdays into account.

2018-07-25 11_07_23-Rapport 1 - Internet Explorer.png

I know I can find the day of the week via the DayOfWeek function, but couldn't find a way to incorporate this in the formula above.

Basically I need to see the number of weekdays elapsed on a given date compared to the start of that month.

 

I'd appreciate it if anyone could help me with this.

 

Thanks in advance,

Bas


Accepted Solutions
Solution
3 weeks ago
Super User
Posts: 4,019

Re: Calculate number of weekdays between two days

You can use SAS code in VA 7.4, but only in SAS Studio, the web-basing coding interface packaged with VA. I think it would be easier to add this as a new column to your data before loading into VA LASR memory using @Reeza's approach.

View solution in original post


All Replies
PROC Star
Posts: 1,400

Re: Calculate number of weekdays between two days

Are you looking for a Point&Click answer in VA or a simple code answer?

New Contributor
Posts: 4

Re: Calculate number of weekdays between two days

One or the other. That doesn't really matter. I am somewhat familiar with the coding used in VA.

I have only got access to VA 7.4, so if it works there, that would be great.

Super User
Posts: 23,998

Re: Calculate number of weekdays between two days

The INTNX function is available in CAS. 

 

In Base SAS that would be:

 

intnx('weekday', date1, date2)
Solution
3 weeks ago
Super User
Posts: 4,019

Re: Calculate number of weekdays between two days

You can use SAS code in VA 7.4, but only in SAS Studio, the web-basing coding interface packaged with VA. I think it would be easier to add this as a new column to your data before loading into VA LASR memory using @Reeza's approach.

New Contributor
Posts: 4

Re: Calculate number of weekdays between two days

Thank you all for your replies. I think the suggestion given by SASKiwi should be the easiest way for us.

We'll add the extra column to the data, so we can use it for our calculations instead of trying to build it all in the VA interface.

 

Thanks!

Community Manager
Posts: 746

Re: Calculate number of weekdays between two days

Hi @Basl,

 

I'm glad you found some useful info! If @SASKiwi's reply was the exact solution to your problem, can you "Accept it as a solution"? Or if it was particularly helpful, feel free to "Like" it. This will help other community members who may run into the same issue know what worked.

Thanks!
Anna

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 156 views
  • 3 likes
  • 5 in conversation