## Computing "Working Days" using syntax

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

KeithMurray
Posts: 16
Joined: Fri Feb 21, 2014 1:12 pm

### Computing "Working Days" using syntax

I have two columns of data, both of which contain a date in Date11 format. The first relates to the start of an event, the second to the end of the event.

I am trying to write syntax that computes the number of working days - i.e. calendar days minus Saturdays and Sundays - between the two dates. Has anyone else tried to do this, and succeeded? Maybe I'm just missing something simple ...

Any help appreciated.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

### Re: Computing "Working Days" using syntax

just go to the date time wizard and paste the output!
KeithMurray
Posts: 16
Joined: Fri Feb 21, 2014 1:12 pm

### Re: Computing "Working Days" using syntax

Hi Gutnre

As you suggest, I'm in the Date and Time Wizard, using the option Calculate with dates and times/Calculate the number of time units between two dates ....

Trouble is, the time interval calculated is a calendar duration, rather than working duration ....

Am I in the right bit of the wizard?
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

### Re: Computing "Working Days" using syntax

i don't know what you mean by calander duration and working duration.
KeithMurray
Posts: 16
Joined: Fri Feb 21, 2014 1:12 pm

### Re: Computing "Working Days" using syntax

Calendar duration refers to the number of days between two dates.

Working duration refers to the total number of Mondays to Fridays between two dates. That is, you exclude Saturdays and Sundays.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

### Re: Computing "Working Days" using syntax

aah ok, no, I don't know if spss can do that automatically, I think not.
Can you maybe just (result *.714)?
KeithMurray
Posts: 16
Joined: Fri Feb 21, 2014 1:12 pm

### Re: Computing "Working Days" using syntax

Hi Gutnre

No, I didn't think there was a direct way of doing this. The problem with multiplying by 5/7 is that while it's fairly good for long durations, it doesn't work well for short. An event that start on the Friday, for example, and finishes on the following Monday, would have a working duration of one day: by multiplying 3 calendar days (Saturday, Sunday, Monday) by 5/7 would give, er, 2.14.

The annoying thing is that I have worked this out in the past, using syntax, so I know there's a solution out there somewhere!

Anyway, thanks for your help. Will keep trying.

### Who is online

Users browsing this forum: No registered users and 2 guests