Not so. "2 C" will not be assigned the same value as "1 A".
Nick
[email protected]
Luciana M. Alencar, M.D.
I believe the following will do the job:
egen var1 = group (id title)
Mike Kim
I would like to create 'var1' in the following table based on id and
title.
I tried "bysort id title: gen var2=_n" and this creates var2 which is
different from var1.
I also tried "by id: egen var1=group(title)", but egen does not allow
'by'.
How can I create var1?
id title var1 var2
1 A 1 1
1 A 1 2
1 B 2 1
1 B 2 2
1 B 2 3
2 C 1 1
2 C 1 2
2 C 1 3
2 D 2 1
2 D 2 2
3 E 1 1
.......
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/