Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: RE: First visit to clinic


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: First visit to clinic
Date   Mon, 20 Sep 2010 17:53:58 +0200

<>

Paul may want to look at NJC´s
http://www.stata-journal.com/sjpdf.html?articlenum=pr0004


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Montag, 20. September 2010 15:30
To: [email protected]
Subject: st: RE: First visit to clinic


<>

*************
bys id (date):
*************


HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Paul O'Brien
Sent: Montag, 20. September 2010 15:25
To: statalist
Subject: st: First visit to clinic

i want to create a new variable with the date of the first visit of each
patient:

id		date		date_of_first_visit
N-00-3558	07/04/2008	07/04/2008
N-00-3558	09/04/2008	07/04/2008
N-00-3558	14/05/2008	07/04/2008
N-00-3563	05/06/2007	
N-00-3563	31/03/2010	
N-00-3565	05/06/2007	
N-00-3565	13/06/2008	
N-00-3565	13/06/2008	
N-00-3565	05/05/2009	
N-00-3565	04/03/2010	
N-00-3583	09/09/2008	
N-00-3583	27/05/2009	

i know this should be easy by i am having trouble using n_1

i have tried:
.sort date
.by id, sort: gen visit=_n==1

but the latter does not have the date in order, only id.

any help gratefully received.

paul

------------------------------
Dr Paul O'Brien
Raymede Clinic
Westside Contraceptive Services
Central London Community Healthcare
Exmoor St
London
W10 6DZ
UK
+44 (0)20 8962 4450










*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index