Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

intck('weekday'

Status
Not open for further replies.

shenniko

Programmer
Apr 15, 2005
52
US
Hi All,

Need some help with the intck('weekday' statement...

I have the below code.

Code:
Data Test;
	DateDiff = intck('weekday', '01JUN2007'd, '12JUN2007'd);
run;

Now there should be 8 weekdays between those two dates, but when i run the code i only get 7...

I want to see how many weekdays between a ticket being opened and a ticket being closed.

Does it class the 12th of june as a day? or would i need to add an extra day on to count that day?

Thanks

Robbie
 
I count 7 weekdays between june 1 and june 12 of 2007. Remember, you are asking the SAS functions to tell you how many weekdays are there between (this being the key word) the two dates. The first day is not counted.

So what I would do is first decide if you would k=like to count the first day. Then if the answer is yes write a check to see if the first day is a weekday. Then if that evaluates to 'true' then add one day to the number that the INTCK function returns.
ex.
Code:
if 1 < weekday(youropendate) < 7 then
    DateDiff = intck('weekday', '01JUN2007'd, '12JUN2007'd)+1;
else 
  DateDiff = intck('weekday', '01JUN2007'd, '12JUN2007'd);

Of course you would modify the above example to fit your needs.
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top