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

RE: st: RE: Bysort on non-selection variables


From   Richard Williams <[email protected]>
To   [email protected]
Subject   RE: st: RE: Bysort on non-selection variables
Date   Wed, 20 Jul 2005 16:36:22 -0500

At 01:30 PM 7/20/2005 -0700, you wrote:
Thank you kindly, Richard, for taking the time and effort to propose a solution. Unfortunately, -sort-ing as you suggest does not preserve the "serial pernum" ordering I require for the conditions on the -bysort-.

I'll have to try another tack.
Deb, perhaps you could give an example of what you want the sorted data to look like. It sounds like you want to sort on serial, pernum and test, but for some reason you can't specify all three simultaneously.
(Why not -sort serial pernum test, stable- ? ) Also, perhaps the example you gave earlier wasn't representative of what you were trying to do, but it wasn't clear to me why the data needed to be sorted in the first place, i.e. I believe these commands

. 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)

are going to produce the same results whether you sort or not, i.e. the sorting isn't going to affect the results produced by -replace-.




-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc

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