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

st: RE: Bysort on non-selection variables

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Bysort on non-selection variables
Date   Tue, 19 Jul 2005 00:13:34 +0100

Two suggestions: 

1. Do you also need a unique id? 

gen uniqueid = _n 

2. Check out the -stable- option. 

[email protected] 

Deborah Garvey, Ph.D.
> I have data with a household identifier (serial) and a person 
> locator within each household (pernum).
> Is there any way to maintain a sort order of PERNUM within 
> SERIAL, i.e., the results of a command like -sort serial 
> pernum-  for a -bysort- that is sorted on a within-household 
> indicator variable, i.e. -bysort serial (indicatorvar): 
> several expressions to condition the value of a PERNUM-level variable-
> My question may seem odd, but the person's location in the 
> household is an important criterion for determining the 
> indicator variable's value. Unfortunately, the value of the 
> indicator variable may be the same for more than one person 
> in the household, so I can't use -bysort serial pernum 
> (indicatorvar):  stuff-

*   For searches and help try:

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