First question

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

First question

Sandeep Soman
Hello
I am fairly new to this list and with no major background in syntax, but
very eagerly inclined to learn and this listserv has been most helpful.
I have the following data: (patient id, admit id-unique for each
different admission, date of lab test, military time of test result,
result value)
111     1.00    6/15/2005           2:59:00           2.3
111     1.00    6/16/2005           10:02:00     2
111     1.00    6/16/2005           21:00:00     2
111     1.00    6/17/2006           6:00:00       2.2
111     2.00    8/1/2006            20:57:00     2.6
111     2.00    8/2/2006            22:11:00     2.7
111     2.00    8/3/2003            22:10:00     2.6
222     3       1/10/2002    6:00:00       3.2
222     3       1/11/2002           6:00:00       2.9
222     3       1/5/2002           16:47:00      3.7
222     3       1/6/2002           3:19:00            3.5
222     3       1/6/2002           12:06:00     3.8
222     3       1/7/2002           9:00:00           3.5
222     3       1/8/2002           2:45:00           3.3

My question is this:
How do I identify the minimum, maximum, mean and percentage change in
lab test result (with date and time) for each unique admission for each
patient ID. (each patient could have more than 2 or more admissions and
hence more than one unique admit id for each patient id).
Thanks, and help appreciated.
Sandeep

Sandeep Soman, MD
Senior Staff Physician
Division of Nephrology and Hypertension
Henry Ford Hospital
2799 West Grand Blvd, CFP-5
Detroit, MI 48202
Phone:1-313-916 2992
Pager: 1-313-705 2953
Fax: 1-313-916 2554


==============================================================================
Go to http://henryford.com
We're Henry Ford. We Can.

HFHS CONFIDENTIALITY NOTICE: This email contains information from the sender that may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise protected from disclosure. This email is intended for use only by the person or entity to whom it is addressed.  If you are not the intended recipient, any use, disclosure, copying, distribution, printing, or any action taken in reliance on the contents of this email, is strictly prohibited. If you received this email in error, please contact the sending party by replying in an email to the sender, delete the email from your computer system and shred any paper copies of the email you printed.

Note to Patients: There are a number of risks you should consider before using e-mail to communicate with us. These risks are described in our Privacy Policy at http://henryford.com.  Review that policy carefully before continuing to communicate with us by e-mail. For greater Internet security, our policy describes the Henry Ford MyHealth electronic communication process - you may register at http://henryford.com.  If you do not believe that our policy gives you the privacy and security protection you need, do not send e-mail or Internet communications to us.
==============================================================================
Reply | Threaded
Open this post in threaded view
|

Re: First question

Ken Chui
The percentage change from the previous testing within patient and within
admission:

*///// first sort every key variable by ascending order.

SORT CASES BY
  patient (A) admission (A) date (A) time (A) .

*///// assign a lag value of testing "outcome" for each admission.

IF (patient = lag(patient) & admission = lag(admission)) lag1 = lag(outcome) .
EXECUTE .

*///// calculate rate of change in percentage from the previous testing.

COMPUTE
  change_rate = (outcome / lag1) * 100 .
EXECUTE .
DELETE VARIABLE lag1 .
EXECUTE .

However, for the min/max, how would you like to deal with multiple minimums
and multiple maximums?  Would you choose only the first/last?  Or you'd like
a separate data set just show the maximums and minimums in a whole list with
date/time?
Reply | Threaded
Open this post in threaded view
|

Re: First question

Maguin, Eugene
In reply to this post by Sandeep Soman
Sandeep,

Your question will take several steps. I'm going to assume that you want the
min, max, mean and percent change by patient id and not unique id within
patient id. That is, for example, you want those values for the seven
records for patient 111 and not for the four records for unique id=1 for
patient 111.

Sort cases by patient_id result.

Do if ($casenum eq 1).  /* takes care of case 1.
+  compute min_date=labdate.
+  compute min_time=labtime.
+  compute minlab=result.
Else if (patientid ne lag(patientid)).  /* all other cases.
+  compute min_date=labdate.
+  compute min_time=labtime.
+  compute minlab=result.
End if.

Sort cases by patient_id (a) result (d).

Do if ($casenum eq 1).  /* takes care of case 1.
+  compute max_date=labdate.
+  compute max_time=labtime.
+  compute maxlab=result.
Else if (patientid ne lag(patientid)).  /* all other cases.
+  compute max_date=labdate.
+  compute max_time=labtime.
+  compute maxlab=result.
End if.

So now you have the date and time for the minimum and maximum results. The
date/time for the mean is meaningless. Likewise for percent change. I assume
you will want a new dataset.

Aggregate /outfile=*/break=patientid/
   min_date min_time minlab max_date max_time maxlab=
   first(min_date min_time minlab max_date max_time maxlab)/
   averesult=mean(result).

I assume that percent change is the from min to max.

Compute pcnt=(max-min)/min.

I haven't tried this but this is where I'd start.

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

Re: First question

Sandeep Soman
In reply to this post by Sandeep Soman
Thank you. I was actually going to include each admission for each
patient and hence I was going to go by the admit id.
I will run this syntax and let you know.
Thanks again.

Sandeep Soman, MD
Senior Staff Physician
Division of Nephrology and Hypertension
Henry Ford Hospital
2799 West Grand Blvd, CFP-5
Detroit, MI 48202
Phone:1-313-916 2992
Pager: 1-313-705 2953
Fax: 1-313-916 2554

>>> "Gene Maguin" <[hidden email]> 08/20/06 4:35 PM >>>
Sandeep,

Your question will take several steps. I'm going to assume that you want
the
min, max, mean and percent change by patient id and not unique id within
patient id. That is, for example, you want those values for the seven
records for patient 111 and not for the four records for unique id=1 for
patient 111.

Sort cases by patient_id result.

Do if ($casenum eq 1).  /* takes care of case 1.
+  compute min_date=labdate.
+  compute min_time=labtime.
+  compute minlab=result.
Else if (patientid ne lag(patientid)).  /* all other cases.
+  compute min_date=labdate.
+  compute min_time=labtime.
+  compute minlab=result.
End if.

Sort cases by patient_id (a) result (d).

Do if ($casenum eq 1).  /* takes care of case 1.
+  compute max_date=labdate.
+  compute max_time=labtime.
+  compute maxlab=result.
Else if (patientid ne lag(patientid)).  /* all other cases.
+  compute max_date=labdate.
+  compute max_time=labtime.
+  compute maxlab=result.
End if.

So now you have the date and time for the minimum and maximum results.
The
date/time for the mean is meaningless. Likewise for percent change. I
assume
you will want a new dataset.

Aggregate /outfile=*/break=patientid/
   min_date min_time minlab max_date max_time maxlab=
   first(min_date min_time minlab max_date max_time maxlab)/
   averesult=mean(result).

I assume that percent change is the from min to max.

Compute pcnt=(max-min)/min.

I haven't tried this but this is where I'd start.

Gene Maguin



==============================================================================
Go to http://henryford.com
We're Henry Ford. We Can.

HFHS CONFIDENTIALITY NOTICE: This email contains information from the sender that may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise protected from disclosure. This email is intended for use only by the person or entity to whom it is addressed.  If you are not the intended recipient, any use, disclosure, copying, distribution, printing, or any action taken in reliance on the contents of this email, is strictly prohibited. If you received this email in error, please contact the sending party by replying in an email to the sender, delete the email from your computer system and shred any paper copies of the email you printed.

Note to Patients: There are a number of risks you should consider before using e-mail to communicate with us. These risks are described in our Privacy Policy at http://henryford.com.  Review that policy carefully before continuing to communicate with us by e-mail. For greater Internet security, our policy describes the Henry Ford MyHealth electronic communication process - you may register at http://henryford.com.  If you do not believe that our policy gives you the privacy and security protection you need, do not send e-mail or Internet communications to us.
==============================================================================