Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Dividing a dataset


From   <miguel.ampudia@bde.es>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Dividing a dataset
Date   Wed, 12 Apr 2006 13:05:11 +0200

Hi all,

I have a dataset with contains the results of a multiple imputation, so
each observation is contained 5 times. I'm trying to divide this dataset
into 5 different ones (one for each imputed dataset) but I cannot find
an easy way to do it.
My identification variables are 'id' and 'id1':

   list id id1

         +--------------+
         |    id    id1 |
         |--------------|
      1. |    11      1 |
      2. |    12      1 |
      3. |    13      1 |
      4. |    14      1 |
      5. |    15      1 |
         |--------------|
      6. |    21      2 |
      7. |    22      2 |
      8. |    23      2 |
      9. |    24      2 |
     10. |    25      2 |
         |--------------|
     11. |    31      3 |
     12. |    32      3 |
     13. |    33      3 |
     14. |    34      3 |
     15. |    35      3 |
         |--------------|.
=2E

The only thing i could think about is (if 3000 observations):

forvalues m=3D1/3000 {
forvalues n=3D2/5 {
drop if id =3D=3D `m'`n'
}
}

So i'll be keeping imputed dataset number 1. then repeat this for the
rest of datasets. As you can see this is slow and not really practical.
Is there a way it can be done easily?
Thanks.

Miguel



Banco de Espa=F1a - Aviso legal

Este mensaje, su contenido y cualquier fichero transmitido
con =E9l est=E1 dirigido =FAnicamente a su destinatario y es
confidencial. Por ello, se informa a quien lo reciba por error o
tenga conocimiento del mismo sin ser su destinatario, que la
informaci=F3n contenida en =E9l es reservada y su uso no
autorizado, por lo que en tal caso le rogamos nos lo comunique
por la misma v=EDa o por tel=E9fono (+ 34 91 338 66 66), as=ED como
que se abstenga de reproducir el mensaje mediante cualquier
medio o remitirlo o entregarlo a otra persona, procediendo a su
borrado de manera inmediata.

El Banco de Espa=F1a se reserva las acciones legales que le
correspondan contra todo tercero que acceda de forma
ileg=EDtima al contenido de cualquier mensaje externo procedente
del mismo.

Para informacion y consultas visite nuestra web
http://www.bde.es


Banco de Espa=F1a - Disclaimer
This message, its content and any file attached thereto is for
the intended recipient only and is confidential. If you have
received this e-mail in error or had access to it, you should
note that the information in it is private and any use thereof
is unauthorised. In such an event please notify us by e-mail or
by telephone (+ 34 91 338 66 66). Any reproduction of this
e-mail by whatsoever means and any transmission or dissemination
thereof to other persons is prohibited. It should be deleted
immediately from your system.

The Banco de Espa=F1a reserves the right to take legal action
against any persons unlawfully gaining access to the content of
any external message it has emitted.

For additional information, please visit our website
http://www.bde.es

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index