Or, for the simplest problems, 
gen caseid = _n 
Nick 
[email protected] 
P.S. note also that 
. search identifier 
points you to an FAQ on this: 
http://www.stata.com/support/faqs/data/group.html
Alexander Tsai
 
> The subject of your e-mail suggested you wanted a random 
> ID, but your
> e-mail asked for a consecutive ID --
> 
> egen caseid=seq()
> 
> will do the consecutive ID for you.
Clive Nicholas
 
> (1) How do you tell Stata to generate a case ID variable that
> consecutively numbers all the cases in your dataset, 
> starting with 1, 2,
> 3, ... 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/