It is more the other way round. _n remains defined
as 1 to whatever is _N regardless of the sort order
of the data. Which observation is which is what varies.
The consequences are much the same, naturally.
Adding or deleting observations will change the range
of _n, certainly.
Nick
[email protected]
Eric G. Wruck
> Stata does very little automatically. One thing that it does
> do automatically is create a variable _n that contains the
> observation number or record number. However, as soon as you
> sort or do something with the data set, these _ns will
> change. So, to create the variable you seem to want, you'll
> want to use the generate command (usually abbreviated gen):
>
> gen case_id = _n
>
*
* 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/