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: Tips for writing code to consolidate observations?


From   David <[email protected]>
To   [email protected]
Subject   st: Tips for writing code to consolidate observations?
Date   Tue, 13 Nov 2012 22:00:14 +0100

I have a large dataset that has multiple observations per individual
and need to convert to single line observations (9,000 lines rows but
really only a few hundred subjects).  The data columns that account
for the multiple observations are unnecessary (see below, e.g.,
ICD-9).  The first occurrence of the data that I need to capture is
the first time the observation occurs.  As there are about 500
subjects, I was hoping there is some code to convert to single
observations/line.  See the example below of what I have and what I
would like it to look like.


(RAW DATA)

ID   ICD-9     GCS  AIS1 AIS2 AIS3 AIS4 AIS5 AIS6

1    823.2     15         0      1       1       1      0      0
1    849.5
1    823.5
2    849.1     12         0      1       3       3      2      1
3    813.4     11         0      0       3       3      7      7
3    775.1


(IDEAL Final Product)

ID   GCS  AIS1 AIS2 AIS3 AIS4 AIS5 AIS6

1      15      0      1       1       1      0      0
2      12      0      1       3       3      2      1
3      11      0      0       3       3      7      7


Much appreciated,

David Zonies, MD MPH
Landstuhl Regional Medical Center
Landstuhl, Germany
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index