LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 17 Jan 2002 13:26:59 -0600
Reply-To:     "Foy, Thomas M." <foytho@PARKNICOLLET.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Foy, Thomas M." <foytho@PARKNICOLLET.COM>
Subject:      Re: Calendar Days to Works Days
Comments: To: "David L. Ward" <dward@SASHELP.COM>
Content-Type: text/plain; charset="iso-8859-1"

Thanks David. By modifying this line as such: week_days=intck('weekday',first_day,last_day) + 1; I was able to accomplish my goal of including the first day and last day in the total number of days.

Thanks,

Tom

-----Original Message----- From: David L. Ward [mailto:dward@SASHELP.COM] Sent: Thursday, January 17, 2002 11:48 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Calendar Days to Works Days

Tom,

You can easily get the number of week days in a given time period: data _null_; first_day='01JAN2002'd; last_day ='17JAN2002'd; week_days=intck('weekday',first_day,last_day); put week_days=; run;

If you need to count holidays then you will need a separate list of holidays to subtract from your total (find the number of holidays that occur between your interval).

HTH David Ward -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Foy, Thomas M. Sent: Thursday, January 17, 2002 12:12 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Calendar Days to Works Days

Hi Everyone:

This may be a question that has been asked before, if so, please be patient.

The question I have is: How does one go about calculating the number of weekdays in a given time period? For example, I am working with disability data, and the amount of disability a person was paid for that time. What I need are the number of work days the person is being paid for.

The code I am attempting to use looks like this and is not working as well as it should.

data workdays; set <data set>; work_weeks = int(total_days/7); remainder_days = mod(total_days,7);

if remainder_days in (6,7) then remainder_days = 5;

work_days = (work_weeks * 5) + remainder_days; run;

Total_days is the last day of observation minus the first day of observation. This is where things go awry. Depending on the day of the week of the first and last days fall on alters the actual number of week days, or work days.

Any light anyone could shine on this would be greatly appreciated.

Thanks,

Tom Foy

PRIVACY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain business confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If this e-mail was not intended for you, please notify the sender by reply e-mail that you received this in error. Destroy all copies of the original message and attachments.

PRIVACY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain business confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If this e-mail was not intended for you, please notify the sender by reply e-mail that you received this in error. Destroy all copies of the original message and attachments.


Back to: Top of message | Previous page | Main SAS-L page