For the first question, I think you are looking for -reshape-
For example:
//Create panel data set
clear
set obs 66
gen id = _n
expand 45
bysort id: gen year = 1959 + _n
sort id year
gen y = uniform()
//transform
reshape wide y, i(year) j(id)
//calc bilateral differences
local j =1
forv l = `j'/66 {
forv k = `j'/66 {
if `l' != `k' {
gen diff_`l'_`k' = y`l' - y`k'
}
}
local ++j
}
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Cigdem Akin
> Sent: Wednesday, September 27, 2006 4:38 PM
> To: [email protected]
> Subject: st: Stata inquiry
>
> Hi,
>
> I have a panel of GDP values for 66 countries. I have the following
> questions.
>
> 1- The data is stacked on top of each other in the following manner. id:1-
> 66 yr:1960-2005
>
> yr id y
> 1960 1 .
> until 2005 1 .
> 1960 2 .
> until 2005 2 .
>
> I need to construct bilateral pairs of lny-lny*. This makes about 2165
> pairs for 66 countries.
>
> How can I program this in STATA environment?
>
> 2- Using these bilateral difference series, I need to conduct lag length
> selection using varsoc command 2165 times for each series. The appropriate
> lag length needs to be fed in into the dfuller test.
>
> Can you help me with the programming of these commands? I will be happy to
> provide more information about the dataset and other details about the
> type of output I need?
>
> Thanks.
>
> Cigdem Akin
> George Washington University
> Department of Economics
> *
> * 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/
*
* 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/