Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Creating a dataset from a file with multiple observations


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: Creating a dataset from a file with multiple observations
Date   Wed, 15 Dec 2004 10:30:27 -0500

I'm not sure I fully understand, but this may do what you want:

bysort ID Procedure (Date): keep if Procedure==1 & Date==Date[1]

Michael Blasnik
[email protected]

----- Original Message ----- From: "Natarajan, Raj" <[email protected]>
To: <[email protected]>
Sent: Wednesday, December 15, 2004 10:12 AM
Subject: st: Creating a dataset from a file with multiple observations



Dear Statalist:

I have to create a data set with ID,dates and classifications for a
particular procedure done on patients.

Detail:

I have a large dataset with four variables similar to the example
below: ID, Procedure (procedure done on different sites), Date of
procedure (Date) and Class (Classification).

ID Procedure Date Class

934510 1 27 Aug 03 1.0
934510 1 27 Aug 03 8.0
934510 1 27 Aug 03 15.0 934510 2 24 Sep 03 1.0
941423 4 10 Oct 02 15.0
941423 1 10 Oct 03 13.0
834561 1 20 Dec 02 16.0
834678 1 12 Jun 01 1.0
834678 2 21 Feb 02 5.0
834678 1 14 Mar 02 18.0
834678 3 02 Nov 03 30.4

I would like to create a data set for the first procedure 1 done on the
same date with the classifications. The outcome should be like this:


ID Procedure Date Class

934510 1 27 Aug 03 1.0
934510 1 27 Aug 03 8.0
934510 1 27 Aug 03 15.0
941423 1 10 Oct 03 13.0
834561 1 20 Dec 02 16.0
834678 1 12 Jun 01 1.0

Any suggestions?

Thanks.

Raj Natarajan
Roswell Park Cancer Institute
Buffalo, NY 14263
Phone: 716-845-8085

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index