Taggert J Brooks' problem <[email protected]>
can be approached in a different way that gets round
the missing data / incomplete panel issue.
> I have a panel data set on individual
> countries and I
> want to create a new variable. The variable is going to be
> the ratio of a
> variable I already have in my dataset, we'll call it P. I
> want to create a
> variable we'll call X where x=p/p(i==72). That is to say I
> want to deflate
> all the values of p, by the value of p for country 72, for
> the corresponding
> year.
Assume the data is saved in myfile.dat.
use country year p using myfile if country == 72, clear
drop country
rename p p72
mmerge year using myfile , type(1:n)
gen x = p/p72
x will be missing only if p72 == 0, p ==. or p72 == .
************************
Paul Seed
[email protected]
Medical Statistician
Wolfson Institute of Preventive Medicine
Charterhouse Square
London EC1M 6BQ
(020) (+44) 7882 6298
fax 7882 6270
*
* 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/