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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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