BookmarkSubscribeRSS Feed
hugo_spss
Calcite | Level 5

Hello!

Is there a command to show the working days a year in a data set?

1 REPLY 1
ballardw
Super User

You will need to qualify what you mean by "weekdays" or "workdays" in a data set. You can set a flag for a given SAS date type variable as to whethere it is a weekday but the code varies by national location.

For example in a data step given a SAS data variable called date:

WeekDayFlag = (weekday(date) in (2,3,4,5,6)); /* will set a value of 1 for Monday through Friday in most US installations and 0*/

And if you mean workdays to exclude certain holidays or observances you will need to define them. Also does the organization work on Saturday?

There is a Holiday function that return the date of some holidays for a given year but if you have something not on that list ...

You could modify the flag above say for a given holiday similar to:(assumes "year" of data is 2013)

If date=holiday('easter',2013) then WeekDayFlag=0; /* assuming Easter isn't a day you want counted*/

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 1052 views
  • 0 likes
  • 2 in conversation