Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: creating an index variable: number of presentations to hospital by participant


From   Alison McCarthy <statslearner@live.com>
To   stata <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: creating an index variable: number of presentations to hospital by participant
Date   Thu, 28 Oct 2010 18:21:07 +1030

Dear Kieran and statalist
 
regarding the formula below. Is there a way to also split this up by year of presentation? 
This means you have the number of ordered presentations for each participant calculated seperately for each year.
Thankyou for your help
Allison


----------------------------------------
> Subject: st: RE: creating an index variable: number of presentations to hospital by participant
> Date: Tue, 14 Sep 2010 10:01:57 +0800
> From: Kieran.McCaul@uwa.edu.au
> To: statalist@hsphsun2.harvard.edu
>
> ....
>
> You'll need some sort of patient ID that identifies individuals.
> Assuming you have that, then:
>
> sort patient_id arrivaldate, stable
> by patient_id: gen order=_n
>
>
> look at -help sort- for an explanation of the option -stable-.
>
> Without this option, sort will randomly order observations with the same
> patient_id and arrivaldate.
>
> Of course, if you have the arrival time as well, you could sort on:
>
> sort patient_id arrivaldate arrivaltime, stable
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Alison
> McCarthy
> Sent: Tuesday, 14 September 2010 9:24 AM
> To: stata
> Subject: st: creating an index variable: number of presentations to
> hospital by participant
>
>
> Dear statalist,
>
> I am working with a large data file containing presentations to a
> hospital emergency department (ED). A number of individuals make more
> than one presentation, which I have seen via the command 'duplicate'.
> The organisation of my data is below:
>
> ARRIVALDATE repeaters part_ID age DISCHARGEDATE
> 30-Mar-10 0 70 50 30-Mar-10
> 30-Mar-10 0 70 50 30-Mar-10
> 31-Mar-10 0 70 50 31-Mar-10
> 01-Apr-10 0 70 50 01-Apr-10
>
>
> As can be seen, this person presented twice to the ED on the one day;
> the second person presenting twice in a two-day period.
>
> I wish to create a new variable which tells me the number and order (in
> terms of date) of presentations for each participant, and would greatly
> appreciate some guidance.
>
> Kind regards
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/ 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index