[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: RE: Issue with rounding
I think they want to know when a variable becomes constant for the remaining
observations within a group, even if it is not constant for the whole group.
If that is correct, then they might try:
gsort id -date
by id: gen sameaslast=sum(var==var)==_n
Which should flag observations which are the same as all of the remaining
observations within a given id.
----- Original Message -----
From: "Nick Cox" <email@example.com>
Sent: Friday, October 06, 2006 7:42 AM
Subject: st: RE: Issue with rounding
The way to solve these problems is to avoid them.
Your problem is to check something, not to
The most direct way to see whether values of
-some- variable remain constant in groups of
bysort block (some) : assert some == some[_N]
If there is any difference between values, this
will show up as a difference between the first (smallest)
and the last (largest). Conversely, if all values are
the same, the first and last will also be the same.
* For searches and help try: