Fw: Identify Break in Service Use

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fw: Identify Break in Service Use

Doug Harden
I figured this out - I needed to remove the COMPUTE Pdate = 0. Thanks to David for directing me to the right places to figure this out.


DG



From:        Doug Harden <[hidden email]>
To:        [hidden email]
Date:        04/17/2013 04:44 PM
Subject:        Re: Identify Break in Service Use
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Thanks David,

I went on the list archives. I found the syntax and adapted it to my variables. But I have a follow up question.The syntax returns a very large and unusable number in the first instance of the date diff comparison. See the first instance of diff is 155307. How do I rewrite the syntax so it doesn't do that? The rest of the values makes sense. Anything greater than 31 is a value I can note as a noncontinuous value and flag it.

Here is my syntax

COMPUTE Pdate = 0.
SORT CASES BY USEID Sdate (A).
IF (USEID  = lag(USEID,1)) PDate=lag(StartDate,1).
FORMATS PDate (DATE11).
COMPUTE diff=Datediff(Sdate,PDate,"Days").

Here is the outcome
USEID TYPE Sdate diff
4567
4E
1/1/2008
155307
4567
4E
2/1/2008
31
4567
4E
3/1/2008
29
4567
4E
4/1/2008
31
4567
4E
5/1/2008
30
4567
4E
7/1/2009
426
4567
4E
8/1/2009
31
4567
4E
9/1/2009
31