From | Richard Williams <[email protected]> |
To | [email protected] |
Subject | RE: st: RE: Bysort on non-selection variables |
Date | Tue, 19 Jul 2005 19:25:47 -0500 |
At 03:46 PM 7/19/2005 -0700, Deborah Garvey wrote:
Dear Nick,The -bysort- command is changing the sort order. The sort command sorts by serial & pernum, bysort sorts by serial and test. Perhaps you want to add test to the sort command, e.g. -sort serial test pernum, stable-
Thanks for suggesting the -stable- option. It crossed my mind after reading the -sort- thread from last month. However, the -stable- option with -sort- doesn't keep the data in serial/pernum order at the -bysort- command. Did I mess something up? Test commands and sample output below.
Thanks,
Deb
. use "C:\dlgarvey\Census data\IPUMS data\temp.dta", clear
. sort serial pernum, stable
. gen test=momloc
. bysort serial (test): replace test=8 if momloc==1
(30 real changes made)
. l serial pernum momloc test
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |