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*/

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 698 views
  • 0 likes
  • 2 in conversation