vector/loop syntax needed here?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

vector/loop syntax needed here?

Tanya Temkin
Your input on this is appreciated?.I have a cohort of callers calling a
medical advice line within a set time period; our aim is to identify those
who receive a specific diagnosis within 30 days after a call ? any call.
Some cases called only once; other ?high utilizers? called 20 times.

This is a sample of cases (real N = about 82,000)

Patient ID      Date of dx      Date call 1     Date call 2     Date call
3       Date call N
abcabc  6/30/05         9/1/04          9/15/05         7/5/05
defdef  7/21/05         7/22/05         11/1/05
ghighi  1/2/06          5/2/06          8/9/06          10/2/06
jkljkl                  7/16/06
mnomno  11/30/05        12/1/04         7/7/05          1025/05 11/19/05


About 13,000 callers got diagnoses. I haven't crunched the data yet, but I
expect that:
  Some got a diagnosis within 30 days after the first call
  others got diagnoses after 30 days after the first call, but before
their second call
  Some got a diagnosis within 30 days after the second call
  others got diagnosed after 30 days after the second call, but before
their third call
And so forth.

The rest of the callers didn't get a diagnosis - fortunately our disease
of interest isn't 100% prevalent.

There is only one diagnosis date variable, representing the first
diagnosis the caller received in the relevant time period.

Before I joined this mailing list a couple weeks ago, I was planning to
compute date differences between first call and date of diagnosis, then
recode cases with a date difference >0 and < 30 days to a new variable
with a value of 1. Then, for those who didn?t receive a diagnosis within
30 days of first call, compute date difference between second call and
date of diagnosis, then recode those who met the < or = 30 day criterion,
etc etc.  This is doable but tedious and clunky,

Then I started reading about vectors and loops. I am not fluent in V & L ?
should I use them here? If so, do my date variables have to be contiguous
in order to define my vector? (each call date variable also has a separate
time variable stuck next to it).

Thanks for your guidance.

Regards

Tanya

Tanya Temkin
Research Associate
AACC Reporting
Northern California Regional Office
The Permanente Medical Group

NOTICE TO RECIPIENT:  If you are not the intended recipient of this
e-mail, you are prohibited from sharing, copying, or otherwise using or
disclosing its contents.  If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and permanently
delete this e-mail and any attachments without reading, forwarding or
saving them.  Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: vector/loop syntax needed here?

Tanya Temkin
Gene,

to answer your questions:

1.  My stripped-down mock data set *does* include a diagnosis date ("Date
of dx")  - second column, to the right of "patient ID" - this precedes the
variables for call #1, call #2, call #3, etc. Here it is again, in case it
didn't come thru legibly the first time (actually has a couple date
corrections):

Patient ID      Date of dx      Date call 1     Date call 2     Date call
3       Date call N
abcabc          6/30/05         9/1/04          7/5/05          9/15/05
dfedfe          7/22/05         7/21/05         11/1/05
ghighi          5/2/06          1/2/06          8/9/06          10/2/06
jklfjkl         .               7/16/06
mnomno  11/30/05        12/1/04         7/7/05          10/25/05 11/19/05


2. We are interested only in FIRST diagnosis received after a call, even
if the person subsequently got other diagnoses or was assigned the first
diagnosis a second or third time. So if the person got their first
diagnosis within 30 days after call #2, say, we wouldn't continue to see
if s/he got another dx after call #3. If s/he didn't get a dx within 30
days after call #2, we would then determine if s/he was diagnosed 30 days
after call #3, and so forth.

3. As for callers who called several times in a short time - our research
design presumes that a diagnosis following a call within 30 days is
associated with the call - so the first call preceding a diagnosis up to
30 days later is considered the key call, even if there were subsequent
calls. This does indeed happen. (We are looking only at calls that involve
specific symptoms that are associated with our diagnoses of interest.)

Thanks,

Tanya

NOTICE TO RECIPIENT:  If you are not the intended recipient of this
e-mail, you are prohibited from sharing, copying, or otherwise using or
disclosing its contents.  If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and permanently
delete this e-mail and any attachments without reading, forwarding or
saving them.  Thank you.




"Gene Maguin" <[hidden email]>
11/07/2006 02:52 PM

To
Tanya L TemKin/CA/KAIPERM@KAIPERM
cc

Subject
RE: vector/loop syntax needed here?






Tanya,

Maybe you omitted it for clarity but in your sample dataset, there is no
DX
date. How can you know whether a dx was made within 30 days of a call?
Also,
if a person calls several times can they get several dxs, such that they
got
a dx after every call? Lastly, if a person called several times over a
short
period and eventually got a dx, how do you know which call should be
associated with the dx?

Please post back to the list and include my questions in your reply so
that
all can see.

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: vector/loop syntax needed here?

hillel vardi
In reply to this post by Tanya Temkin
Shalom


 Here is an example of how you can calculate how many days past from
first and last call by a patient to the dx date .

 One more thing you have to consider is that a patient may look for more
then one type of advice, there for your data should have information on
the type of the question and if the answer match that question.

I used the long form of the data and there for didn't need any loop or
vector , I believe that is also the native arrangement of the original
data in your institution database .


run name            calculate date call and dx .
new file .
input program .
loop      subject=1 to 10 .
leave   subject .
loop      time=1 to 10 .
compute   actdate= date.dmy(1,1,2005) +uniform(365)*(60 * 60 * 24) .
recode    time( 3 8=2)(else=1) into datetype.
value lables   datetype 1 'Date of dx' 2 'Date call' .
end case .
end loop .
end loop .
end file .
end input program .

formats   actdate(edate10) .
sort cases by subject actdate  .
add files   file=* / by subject / first=first.
numeric    calldate firstcall(edate10) .
leave     calldate firstcall .
if  first eq 1   calldate=$sysmis.
if  first eq 1   firstcall=$sysmis.
if   lag(datetype,1) eq 2  firstcall=actdate.
if  datetype eq 1   calldate=actdate.
if  datetype eq 2   lastdxdays=datediff(actdate,calldate,'days').
if  datetype eq 2   firstdxdays=datediff(actdate,firstcall,'days').
formats    firstcall(edate10) .
execute .


Hillel Vardi

Faculty of Health Sciences

Ben-Gurion University

Israel



Tanya Temkin wrote:

> Your input on this is appreciated?.I have a cohort of callers calling a
> medical advice line within a set time period; our aim is to identify those
> who receive a specific diagnosis within 30 days after a call ? any call.
> Some cases called only once; other ?high utilizers? called 20 times.
>
> This is a sample of cases (real N = about 82,000)
>
> Patient ID      Date of dx      Date call 1     Date call 2     Date call
> 3       Date call N
> abcabc  6/30/05         9/1/04          9/15/05         7/5/05
> defdef  7/21/05         7/22/05         11/1/05
> ghighi  1/2/06          5/2/06          8/9/06          10/2/06
> jkljkl                  7/16/06
> mnomno  11/30/05        12/1/04         7/7/05          1025/05 11/19/05
>
>
> About 13,000 callers got diagnoses. I haven't crunched the data yet, but I
> expect that:
>   Some got a diagnosis within 30 days after the first call
>   others got diagnoses after 30 days after the first call, but before
> their second call
>   Some got a diagnosis within 30 days after the second call
>   others got diagnosed after 30 days after the second call, but before
> their third call
> And so forth.
>
> The rest of the callers didn't get a diagnosis - fortunately our disease
> of interest isn't 100% prevalent.
>
> There is only one diagnosis date variable, representing the first
> diagnosis the caller received in the relevant time period.
>
> Before I joined this mailing list a couple weeks ago, I was planning to
> compute date differences between first call and date of diagnosis, then
> recode cases with a date difference >0 and < 30 days to a new variable
> with a value of 1. Then, for those who didn?t receive a diagnosis within
> 30 days of first call, compute date difference between second call and
> date of diagnosis, then recode those who met the < or = 30 day criterion,
> etc etc.  This is doable but tedious and clunky,
>
> Then I started reading about vectors and loops. I am not fluent in V & L ?
> should I use them here? If so, do my date variables have to be contiguous
> in order to define my vector? (each call date variable also has a separate
> time variable stuck next to it).
>
> Thanks for your guidance.
>
> Regards
>
> Tanya
>
> Tanya Temkin
> Research Associate
> AACC Reporting
> Northern California Regional Office
> The Permanente Medical Group
>
> NOTICE TO RECIPIENT:  If you are not the intended recipient of this
> e-mail, you are prohibited from sharing, copying, or otherwise using or
> disclosing its contents.  If you have received this e-mail in error,
> please notify the sender immediately by reply e-mail and permanently
> delete this e-mail and any attachments without reading, forwarding or
> saving them.  Thank you.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: vector/loop syntax needed here?

Maguin, Eugene
In reply to this post by Tanya Temkin
Tanya,

Dx date is there. I see it now. I didn't look carefully enough.

Ok, let date1 to date15 be the call dates and are arranged to be contiguious
in the file. I've assumed you have as many as 15 calls. You should adjust
this number to reflect the actual maximum number. Inperiod is the marker for
a dx within 30 days of the call date.

Vector call=date1 to date15.
Compute inperiod=0.
Loop #i=1 to 15.
+  compute #days=(dxdate-call(#i))/(24*3600*30).
+  do if (sysmis(#days)).
+     break.
+  else if (#days ge 0 and #days le 30).
+     compute inperiod=1.
+     break.
+  end if.
End loop.

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: vector/loop syntax needed here?

Richard Ristow
A detail here.

At 09:42 AM 11/8/2006, Gene Maguin wrote:

>Vector call=date1 to date15.
>Compute inperiod=0.
>Loop #i=1 to 15.
>+  compute #days=(dxdate-call(#i))/(24*3600*30).
>+  do if (sysmis(#days)).
>+     break.
>+  else if (#days ge 0 and #days le 30).
>+     compute inperiod=1.
>+     break.
>+  end if.
>End loop.

In statement

+  compute #days=(dxdate-call(#i))/(24*3600*30).

it looks like you're trying to get a time interval in days, though if
so the denominator is wrong. (The number of seconds in a day is
24*3600=86,400.)

But whether you've made a mistake or I've misunderstood what you're
doing, your code could be made clearer by using SPSS date-time
functions. I suggest, if indeed you want number of days,

+  compute #days=CTIME.DAYS(dxdate-call(#i)).

It's clearer, and doesn't depend on details of SPSS's date-time
representation.