Login  Register

Re: Counting Consecutive Dates or Gaps in dates

Posted by Mahbub Khandoker on Apr 04, 2007; 4:22pm
URL: http://spssx-discussion.165.s1.nabble.com/Counting-Consecutive-Dates-or-Gaps-in-dates-tp1074911p1074913.html

Hi John,
I am not sure how your dataset is designed. So I assume the following dataset for five months and calculate gapes for each client id.

DATA LIST free/ id(n2) month(n2).
Begin data
1 1
1 2
1 3
1 4
1 5
2 1
2 3
2 4
3 2
3 3
3 4
3 5
4 1
4 2
4 4
4 5
End data.

CASESTOVARS
/ID=id.

COUNT
service = month.1 to month.5 (1 thru 5).

Compute Gaps=5-Service.
Exe.

Hopefully some one from the list comes up with more efficient way to do this.
Thanks,
Mahbub

Mahbub Khandoker
IT/DS Coordinator
IMG-Decision Support
Tel: 416 535 8501 Ex 6534
Fax: 416 260 4154

 -----Original Message-----
From:   SPSSX(r) Discussion [mailto:[hidden email]]  On Behalf Of Hughes, John
Sent:   4-Apr-07 10:18 AM
To:     [hidden email]
Subject:             Counting Consecutive Dates or Gaps in dates

I have one record per client per month but some have stops and restarts.
I would like to count either how many gaps there are in service or the
number of months of service that are consecutive. Any help would be
appreciated!



John Hughes, Ph.D.

Director, Decision Support Services

Office of Early Learning

Agency for Workforce Innovation

107 East Madison Street

MSC 140

Tallahassee, FL 32399

850.921.3471 (Office)

850.414.2434 (Fax)



Please note: Florida has a very broad public records law.  Most written
communications to or from state officials regarding state business are
public records available to the public and media upon request.  Your
e-mail communications may therefore be subject to public disclosure.