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

st: scripting question (_n)


From   "kelly johnson" <[email protected]>
To   [email protected]
Subject   st: scripting question (_n)
Date   Fri, 26 Aug 2005 11:43:48 -0400

Hi,

I have a variable (var1) like this:

var1
a
a
a
a
a
b
a
a
a
b
a
... (there are several thousand of these)

I want to creat a unique number to identify each set from a-b. e.g.:
var1 var2
a 1
a 1
a 1
a 1
a 1
b 1
a 2
a 2
a 2
b 2
a3
...
I know how to use the _n command, but am unsure of how to employ it in this case (i can do it in the opposite order). any help would be appreciated.

kelly

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

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