<>
Also: Use the time series operators for proper first differencing. See - h
tsvarlist-
*************
clear*
input str10 Ind str10 Cty year
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
end
gen intrafirmimports=rnormal(20000,2000)
compress
encode Cty, generate(country)
encode Ind, generate(industry)
//get unique id for pairs
egen indcouID=group(industry country)
xtset indcouID year
// get the diffs
bys indcouID : gen difference = D.intrafirmimports
//let`s see
list, sepby(indcouID) noobs
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von
[email protected]
Gesendet: Freitag, 24. April 2009 17:30
An: [email protected]
Betreff: st: First difference in multidimensional panel
Dear stata list members,
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
Thanks in advance,
Best,
Modhura.
*
* 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/
*
* 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/