Raphael said
I have 100 subjects with 6 obs each. I would like to create a new
variable containing 1s for the first three obs and 2s for the
remaining obs for each id.
bysort id: gen x = cond( _n < 4, 1, 2)
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
*
*   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/