# Re: st: Newbie: matching observations in two adjacent periods

 From Ernest Berkhout <[email protected]> To [email protected] Subject Re: st: Newbie: matching observations in two adjacent periods Date Fri, 11 Mar 2005 16:02:47 +0100

```At 15:48 11/03/2005, you wrote:
>HI list members,
>
>
>We are new to Stata and are are tad lost with regards to the following
>operation we are attempting complete and hoping that someone will be able to
>
>In our data set we have a sample of price observations for period 1 and
>period 2. We would like to isolate these observations that are identical
>between both periods (all observations are coded, therefore identical
>observations will have an identical code in each period). Once the identical
>ones are determined, we would then proceed with computing their price
>ratios. The part that is baffling us is what can we do in Stata in order to
>be able to isolate these identical observations from one adjacent period to
>the next?
>
>I suspect that this is an embarrassingly easy one. ;-)

Well, that depends. I guess that you mean you want to compare _different_
values for _identical_ objects? So you want to identify equal objects, say
products. If your 'identical code' is numeric, the best way to go would be
a reshape:

reshape wide price , i(codevariable) j(period)
gen priceratio = price1/price2

That is, if you have a variable 'period' whith values 1 & 2.

Ernest Berkhout
SEO Amsterdam Economics
University of Amsterdam
******************************************************
For information on flexwork & research: www.tempworkresearch.nl
******************************************************
Room 3.08
1018 WB Amsterdam
The Netherlands

tel.:+ 31 20 525 1657
fax:+ 31 20 525 1686
http://www.seo.nl
===========================
A statistician: someone who insists