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

st: RE: data manipulation


From   "Frank de Libero" <[email protected]>
To   <[email protected]>
Subject   st: RE: data manipulation
Date   Wed, 26 Jan 2005 07:41:37 -0800

In addition to David's response, the format below is in First Normal
Form (1NF), which is preferred. An Internet search on "First Normal
Form" will get you further information.

..Frank

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Simon Moore
Sent: Wednesday, January 26, 2005 7:21 AM
To: [email protected]
Subject: st: data manipulation

I am to work with some data that has been inputted in SPSS in a rather 
unusual format.  Transferring from SPSS into Stata is not the problem - 
rearranging the data into a format I am comfortable with is.  At the 
moment it looks something like this:

id       date       time     person_id Gender    Injury

1        21/1/2005  23:10    1         M         Face
.        .          .        2         M         Head
.        .          .        3         F         Legs
2        23/1/2005  04:15    1         M         Arms
.        .          .        2         F         Feet
3        23/1/2006  05:10    1         F         Face

The data refers to violent incidents in a particular area.  For each 
incident more than one person (the maximum is somewhere around 6 but 
could go higher as new data arrives) may have been involved each 
sustaining different injuries.

I would like to rearrange these data into a form something like this:

id date time gender1 injury 1 gender2 injury2 ...

As far as I can see -collapse- will not help me much.  So, has anyone 
had experience with this type of problem and could you point me in the 
right direction?

Many thanks

Simon Moore
*
*   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/

*
*   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