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

RE: st: scripting question (_n)


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: scripting question (_n)
Date   Fri, 26 Aug 2005 17:00:53 +0100

This assumes, I think, that "b" occurs only 
as singletons, true of the example Kelly 
gave but otherwise not explicit. 

Nick 
n.j.cox@durham.ac.uk 

austin nichols
 
> gen long index=1+sum(var1[_n-1]=="b")
> 
> On 8/26/05, kelly johnson <econometrics@hotmail.com> wrote:
> > I want to creat a unique number to identify each set from a-b. e.g.:
> > var1 var2
> > a 1
> > a 1
> > b 1
> > a 2
> > a 2
> > b 2
> > a3

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index