06-09-2014 04:29 PM
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 toassumes "year" of data is 2013)
If date=holiday('easter',2013) then WeekDayFlag=0; /* assuming Easter isn't a day you want counted*/