Kit Baum and Martin Weiss both quite rightly pointed to -egen, group()-.
In addition, note that typing
. search identifier, faq
would have, among other things, identified this FAQ
FAQ . . . . . . . . . . . . . . . . . . . . . . Creating group
identifiers
3/01 How do I create individual identifiers numbered
from 1 upwards?
http://www.stata.com/support/faqs/data/group.html
which also mentions -egen, group()- and, more importantly, explains the
logic behind it.
Reminder: -search- in your Stata points to many sources of information.
Nick
[email protected]
[email protected]
I have a panel data of share of intra-firm imports (s_{ict}) where
observations vary over industry (i), country (c) and time (t). I need
to calculate the first difference of s_{ict}:
Delta_s_{ict}=s_{ict}-s_{ic(t-1)}.
I am not sure how to do this since I do not have a unique panel
variable.
Also when using tsset how do I create unique id for each
industry-country pair (where both industry and country are string
variables). Any help would be appreciated.
My data is of the following form: Industry(Ind) and Country (Cty) are
both string variables
Ind Cty Yr
1 A 2000
1 B 2000
1 C 2000
1 A 2001
1 B 2001
1 C 2001
1 A 2002
2 A 2000
2 B 2000
2 D 2000
2X B 2001
2X A 2002
2X B 2002
*
* 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/