help for obtaining number of days

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

help for obtaining number of days

Rodrigo Briceño
Dear SPSS users. I honestly have no idea about a request that I must do
in a database of hospital patients.
Each patient has a unique id, with date of admission and date of
discharge. My mission is to get for those patients who where in the
hospital more than once, the days between the date of discharge and the
new date of admission:
An example:

patient 1 went 2 times to the hospital: first one on 07-JAN-2007 and
discharged on 12-JAN-2007 and the second one admitted on 18-JUL-2007 and
discharged on 25-JUL-2007; here the question how many days passed
between 12-jan and 18-jul

patient 100 went 6 times to the hospital: 1) 17-JAN-2007-29-JAN-2007; 2)
21-MAR-2007- 24-MAR-2007; 3) 29-MAY-2007-01-JUN-2007; 4)
17-AUG-2007-22-AUG-2007; 5) 14-SEP-2007-17-SEP-2007; 6) 06-NOV-2007-
09-NOV-2007: here the question is to know the number of days between 29
jan and 21 mar, between 24 march and 29 may, between 01 jun and 17 aug,
between 22 aug and 14 sep and between 17 sep and 06 nov

The thing is that I have patients that wen 2, 3, and until 35 times to
the hospital, so the procedure could be a little complicated.

Any idea?
--

__________________________________________________________________

*Rodrigo Briceño*
Project Manager
Sanigest Internacional

+506  22-91-12-00 ext. 113  * Oficina* *Costa Rica*
+506  22-32-08-30                  *Fax
*+506  88-86-11-77*                  Celular**
*[hidden email] <mailto:[hidden email]>
www.sanigest.com <http://www.sanigest.com/>

MSN: [hidden email] <mailto:[hidden email]>
SKYPE: rbriceno1087

_____________________

This communication contains legal information which is privileged and
confidential. It is for the exclusive use of the address and
distribution, dissemination, copying or use by others is strictly
prohibited. If you have received this communication by error, please
delete the original message and e-mail us.


Esta comunicación contiene información legal privilegiada y confidencial
para el uso exclusivo del destinatario. La distribución, diseminación,
copia u otro uso por terceras personas es estrictamente prohibida. Si
usted ha recibido esta comunicación por error, le rogamos borrar el
mensaje original y comunicárnoslo a esta misma dirección.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: help for obtaining number of days

Albert-Jan Roskam
Hi,

I'd sort it by patient_id and admission date, then use
casestovars, with id = patient_id, then use the
datediff function to calculate the differences between
date_n and date_n+1. Something like that.

Cheers!!
Albert-Jan


--- Rodrigo Briceño <[hidden email]> wrote:

> Dear SPSS users. I honestly have no idea about a
> request that I must do
> in a database of hospital patients.
> Each patient has a unique id, with date of admission
> and date of
> discharge. My mission is to get for those patients
> who where in the
> hospital more than once, the days between the date
> of discharge and the
> new date of admission:
> An example:
>
> patient 1 went 2 times to the hospital: first one on
> 07-JAN-2007 and
> discharged on 12-JAN-2007 and the second one
> admitted on 18-JUL-2007 and
> discharged on 25-JUL-2007; here the question how
> many days passed
> between 12-jan and 18-jul
>
> patient 100 went 6 times to the hospital: 1)
> 17-JAN-2007-29-JAN-2007; 2)
> 21-MAR-2007- 24-MAR-2007; 3)
> 29-MAY-2007-01-JUN-2007; 4)
> 17-AUG-2007-22-AUG-2007; 5) 14-SEP-2007-17-SEP-2007;
> 6) 06-NOV-2007-
> 09-NOV-2007: here the question is to know the number
> of days between 29
> jan and 21 mar, between 24 march and 29 may, between
> 01 jun and 17 aug,
> between 22 aug and 14 sep and between 17 sep and 06
> nov
>
> The thing is that I have patients that wen 2, 3, and
> until 35 times to
> the hospital, so the procedure could be a little
> complicated.
>
> Any idea?
> --
>
>
__________________________________________________________________

>
> *Rodrigo Briceño*
> Project Manager
> Sanigest Internacional
>
> +506  22-91-12-00 ext. 113  * Oficina* *Costa Rica*
> +506  22-32-08-30                  *Fax
> *+506  88-86-11-77*                  Celular**
> *[hidden email] <mailto:[hidden email]>
> www.sanigest.com <http://www.sanigest.com/>
>
> MSN: [hidden email]
> <mailto:[hidden email]>
> SKYPE: rbriceno1087
>
> _____________________
>
> This communication contains legal information which
> is privileged and
> confidential. It is for the exclusive use of the
> address and
> distribution, dissemination, copying or use by
> others is strictly
> prohibited. If you have received this communication
> by error, please
> delete the original message and e-mail us.
>
>
> Esta comunicación contiene información legal
> privilegiada y confidencial
> para el uso exclusivo del destinatario. La
> distribución, diseminación,
> copia u otro uso por terceras personas es
> estrictamente prohibida. Si
> usted ha recibido esta comunicación por error, le
> rogamos borrar el
> mensaje original y comunicárnoslo a esta misma
> dirección.
>
> =====================
> To manage your subscription to SPSSX-L, send a
> message to
> [hidden email] (not to SPSSX-L), with no
> body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send
> the command
> INFO REFCARD
>



      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: help for obtaining number of days

Dennis Deck
In reply to this post by Rodrigo Briceño
I would AGGREGATE by patient to:
  Sum the days in care between those dates
  Count the number of times admitted


Dennis Deck, PhD
RMC Research Corporation
111 SW Columbia Street, Suite 1200
Portland, Oregon 97201-5843
voice: 503-223-8248 x715
voice: 800-788-1887 x715
fax:  503-223-8248
[hidden email]


-----Original Message-----
From: Rodrigo Briceño [mailto:[hidden email]]
Sent: Sunday, April 20, 2008 2:15 PM
Subject: help for obtaining number of days

Dear SPSS users. I honestly have no idea about a request that I must do in a database of hospital patients.
Each patient has a unique id, with date of admission and date of discharge. My mission is to get for those patients who where in the hospital more than once, the days between the date of discharge and the new date of admission:
An example:

patient 1 went 2 times to the hospital: first one on 07-JAN-2007 and discharged on 12-JAN-2007 and the second one admitted on 18-JUL-2007 and discharged on 25-JUL-2007; here the question how many days passed between 12-jan and 18-jul

patient 100 went 6 times to the hospital: 1) 17-JAN-2007-29-JAN-2007; 2)
21-MAR-2007- 24-MAR-2007; 3) 29-MAY-2007-01-JUN-2007; 4) 17-AUG-2007-22-AUG-2007; 5) 14-SEP-2007-17-SEP-2007; 6) 06-NOV-2007-
09-NOV-2007: here the question is to know the number of days between 29 jan and 21 mar, between 24 march and 29 may, between 01 jun and 17 aug, between 22 aug and 14 sep and between 17 sep and 06 nov

The thing is that I have patients that wen 2, 3, and until 35 times to the hospital, so the procedure could be a little complicated.

Any idea?
--

__________________________________________________________________

*Rodrigo Briceño*
Project Manager
Sanigest Internacional

+506  22-91-12-00 ext. 113  * Oficina* *Costa Rica*
+506  22-32-08-30                  *Fax
*+506  88-86-11-77*                  Celular**
*[hidden email] <mailto:[hidden email]> www.sanigest.com <http://www.sanigest.com/>

MSN: [hidden email] <mailto:[hidden email]>
SKYPE: rbriceno1087

_____________________

This communication contains legal information which is privileged and confidential. It is for the exclusive use of the address and distribution, dissemination, copying or use by others is strictly prohibited. If you have received this communication by error, please delete the original message and e-mail us.


Esta comunicación contiene información legal privilegiada y confidencial para el uso exclusivo del destinatario. La distribución, diseminación, copia u otro uso por terceras personas es estrictamente prohibida. Si usted ha recibido esta comunicación por error, le rogamos borrar el mensaje original y comunicárnoslo a esta misma dirección.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: help for obtaining number of days

Mahbub Khandoker
Hi there,
You can try the following syntax. Some one in this group may come up with more efficient way.

DATA LIST /ID 1 admission_date 3-10 (ADATE) Discharge_date 12-19 (ADATE).
BEGIN DATA
1 01/07/07 01/12/07
1 07/18/07 07/25/07
2 01/17/07 01/29/07
2 03/21/07 03/24/07
2 03/29/07 06/01/07
2 08/17/07 08/22/07
END DATA.

SORT CASES BY ID(A) admission_date(A).

compute adm_num = 1.
if (id = lag(id, 1))  adm_num = lag(adm_num, 1)+1.

AGGREGATE
  /OUTFILE=*
  MODE=ADDVARIABLES
  /BREAK=id
  /adm_num_max = MAX(adm_num).

*to drop single admission case.
FILTER OFF.
USE ALL.
SELECT IF(adm_num_max > 1).

if (id = lag(id, 1))  re_ad = lag(Discharge_date, 1).
FORMATS re_ad(ADATE11).

COMPUTE los = CTIME.DAYS(Admission_Date - re_ad) .
EXECUTE .

Cheers!

Mahbub Khandoker
Decision Support
Tel: 416 535 8501 Ex 6534


-----Original Message-----
From: Rodrigo Briceño [mailto:[hidden email]]
Sent: Sunday, April 20, 2008 2:15 PM
Subject: help for obtaining number of days

Dear SPSS users. I honestly have no idea about a request that I must do in a database of hospital patients.
Each patient has a unique id, with date of admission and date of discharge. My mission is to get for those patients who where in the hospital more than once, the days between the date of discharge and the new date of admission:
An example:

patient 1 went 2 times to the hospital: first one on 07-JAN-2007 and discharged on 12-JAN-2007 and the second one admitted on 18-JUL-2007 and discharged on 25-JUL-2007; here the question how many days passed between 12-jan and 18-jul

patient 100 went 6 times to the hospital: 1) 17-JAN-2007-29-JAN-2007; 2)
21-MAR-2007- 24-MAR-2007; 3) 29-MAY-2007-01-JUN-2007; 4) 17-AUG-2007-22-AUG-2007; 5) 14-SEP-2007-17-SEP-2007; 6) 06-NOV-2007-
09-NOV-2007: here the question is to know the number of days between 29 jan and 21 mar, between 24 march and 29 may, between 01 jun and 17 aug, between 22 aug and 14 sep and between 17 sep and 06 nov

The thing is that I have patients that wen 2, 3, and until 35 times to the hospital, so the procedure could be a little complicated.

Any idea?
--

__________________________________________________________________

*Rodrigo Briceño*
Project Manager
Sanigest Internacional

+506  22-91-12-00 ext. 113  * Oficina* *Costa Rica*
+506  22-32-08-30                  *Fax
*+506  88-86-11-77*                  Celular**
*[hidden email] <mailto:[hidden email]> www.sanigest.com <http://www.sanigest.com/>

MSN: [hidden email] <mailto:[hidden email]>
SKYPE: rbriceno1087

_____________________

This communication contains legal information which is privileged and confidential. It is for the exclusive use of the address and distribution, dissemination, copying or use by others is strictly prohibited. If you have received this communication by error, please delete the original message and e-mail us.


Esta comunicación contiene información legal privilegiada y confidencial para el uso exclusivo del destinatario. La distribución, diseminación, copia u otro uso por terceras personas es estrictamente prohibida. Si usted ha recibido esta comunicación por error, le rogamos borrar el mensaje original y comunicárnoslo a esta misma dirección.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

______________________________________________________________________
This email has been scanned by the CAMH Email Security System.
______________________________________________________________________



______________________________________________________________________
This email has been scanned by the CAMH Email Security System.
______________________________________________________________________

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: help for obtaining number of days

hillel vardi
In reply to this post by Rodrigo Briceño
Shalom

The flowing syntax will do what you want .


DATA LIST /ID 1 admission_date 3-10 (ADATE) Discharge_date 12-19 (ADATE).
BEGIN DATA
1 01/07/07 01/12/07
1 07/18/07 07/25/07
2 01/17/07 01/29/07
2 03/21/07 03/24/07
2 03/29/07 06/01/07
2 08/17/07 08/22/07
END DATA.
sort cases by ID  admission_date .
add files  file=* / by id / first =first .
compute      LDischarge_date=lag(Discharge_date ,1).
if  first eq 0   difdays=datediff(admission_date ,LDischarge_date ,'days') .
execute .


Hillel Vardi
BGU


Rodrigo Briceño wrote:

> Dear SPSS users. I honestly have no idea about a request that I must do
> in a database of hospital patients.
> Each patient has a unique id, with date of admission and date of
> discharge. My mission is to get for those patients who where in the
> hospital more than once, the days between the date of discharge and the
> new date of admission:
> An example:
>
> patient 1 went 2 times to the hospital: first one on 07-JAN-2007 and
> discharged on 12-JAN-2007 and the second one admitted on 18-JUL-2007 and
> discharged on 25-JUL-2007; here the question how many days passed
> between 12-jan and 18-jul
>
> patient 100 went 6 times to the hospital: 1) 17-JAN-2007-29-JAN-2007; 2)
> 21-MAR-2007- 24-MAR-2007; 3) 29-MAY-2007-01-JUN-2007; 4)
> 17-AUG-2007-22-AUG-2007; 5) 14-SEP-2007-17-SEP-2007; 6) 06-NOV-2007-
> 09-NOV-2007: here the question is to know the number of days between 29
> jan and 21 mar, between 24 march and 29 may, between 01 jun and 17 aug,
> between 22 aug and 14 sep and between 17 sep and 06 nov
>
> The thing is that I have patients that wen 2, 3, and until 35 times to
> the hospital, so the procedure could be a little complicated.
>
> Any idea?
> --
>
> __________________________________________________________________
>
> *Rodrigo Briceño*
> Project Manager
> Sanigest Internacional
>
> +506  22-91-12-00 ext. 113  * Oficina* *Costa Rica*
> +506  22-32-08-30                  *Fax
> *+506  88-86-11-77*                  Celular**
> *[hidden email] <mailto:[hidden email]>
> www.sanigest.com <http://www.sanigest.com/>
>
> MSN: [hidden email] <mailto:[hidden email]>
> SKYPE: rbriceno1087
>
> _____________________
>
> This communication contains legal information which is privileged and
> confidential. It is for the exclusive use of the address and
> distribution, dissemination, copying or use by others is strictly
> prohibited. If you have received this communication by error, please
> delete the original message and e-mail us.
>
>
> Esta comunicación contiene información legal privilegiada y confidencial
> para el uso exclusivo del destinatario. La distribución, diseminación,
> copia u otro uso por terceras personas es estrictamente prohibida. Si
> usted ha recibido esta comunicación por error, le rogamos borrar el
> mensaje original y comunicárnoslo a esta misma dirección.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD