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

From |
"Russel Wildeman" <rwildeman@idasa.org.za> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: AW: Creating single values from a nested data file |

Date |
Wed, 16 Dec 2009 18:42:25 +0200 |

Because of the nested data structure, the value of the school-level variables (ie those that have been aggregated) will be duplicated for the same school (because for the same school, they must be the same), whereas I wanted only one record (I must not say observation and this is what was perhaps confusing-my apologies) per school. This should do the trick I want to model class size and educational outcomes jointly and the source I am using suggests it is computationally more efficient to have only one record per school. I want to use a multilevel bivariate response model for this task. Thanks again, Russell -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss Sent: 16 December 2009 06:07 PM To: statalist@hsphsun2.harvard.edu Subject: AW: st: RE: AW: Creating single values from a nested data file <> Actually, I had the same idea as Jeph initially, because Rusell requested that "... one of the school-level variables (classize) ... have only one observation per school", but I dismissed it as unlikely. If this is indeed what Rusell wants, I would be interested to hear what kind of analysis requires that the variable have only one non-missing value per unit (Schools in his case). Furthermore, he could then look at -egen, tag()- which would give him an indicator variable which he could condition on in subsequent analysis instead of -drop-ping the remaining cases outright. HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Jeph Herrin Gesendet: Mittwoch, 16. Dezember 2009 17:04 An: statalist@hsphsun2.harvard.edu Betreff: Re: st: RE: AW: Creating single values from a nested data file If I understand correctly, bys school : replace classize=. if _n>1 hth, Jeph Russel Wildeman wrote: > Thank you Martin > > The data look like this > > School Student Classize female > 1 1 35 1 > 1 2 35 0 > 1 3 35 1 > 1 4 35 1 > 2 1 23 0 > 2 2 23 1 > 2 3 23 1 > 3 1 39 0 > 3 2 39 1 > > > What I would like is for one of the school-level variables (classize) to > have only one observation per school. Hope I am a bit clearer. > > Many thanks, > Russell > > > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss > Sent: 16 December 2009 04:03 PM > To: statalist@hsphsun2.harvard.edu > Subject: st: AW: Creating single values from a nested data file > > > <> > > Could be a case for -reshape- or -collapse-. For further help, you should > post a meaningful excerpt of your data. > > > > HTH > Martin > > > -----Ursprüngliche Nachricht----- > Von: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Marcello Pagano > Gesendet: Mittwoch, 16. Dezember 2009 15:04 > An: statalist@hsphsun2.harvard.edu > Betreff: st: Creating single values from a nested data file > > For Russell: > > *From:* Russel Wildeman [mailto:rwildeman@idasa.org.za] > *Sent:* 15 December 2009 07:36 PM > *To:* 'statalist@hsphsun2.harvard.edu' > *Subject:* Creating single values from a nested data file > > Dear Listers, > > I am new to Stata and have the following question. > > I have education survey data where the data are ordered by school and > student and more pertinently the variable ?school.? The data are ordered > by the variable ?school? and would give 0 0 0 0 1 1 1 1 etc. I have > created appropriate school-level variables but the problem is that the > values of the school-level variables are repeated for the same school, > whereas I want only one record per school for some of the school-level > variables. I tried various merging file schemes but none work. Any help > is highly appreciated > > Thanks > > Russell > * > * 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/ > * * 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/

**Follow-Ups**:**RE: st: RE: AW: Creating single values from a nested data file***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**AW: st: RE: AW: Creating single values from a nested data file***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**Re: st: runs test?** - Next by Date:
**st: RE: PCA vs. Factor Loadings** - Previous by thread:
**AW: st: RE: AW: Creating single values from a nested data file** - Next by thread:
**RE: st: RE: AW: Creating single values from a nested data file** - Index(es):

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