Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

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


From   Ernest Berkhout <Ernest.Berkhout@seo.nl>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Newbie: matching observations in two adjacent periods
Date   Fri, 11 Mar 2005 16:32:37 +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
help us please.

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
Roetersstraat 29
1018 WB Amsterdam
The Netherlands

tel.:+ 31 20 525 1657
fax:+ 31 20 525 1686
http://www.seo.nl
===========================
A statistician: someone who insists
on being certain about uncertainty
===========================
*
* 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/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index