[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: generate
Another way:
drop _all
input str9 company_name year var1 var2 var3
firm_A 1990 3 2 5
firm_A 1991 4 2.4 4.8
firm_B 1990 2 1.5 4
firm_B 1991 2 1.6 4.1
all_firms 1990 30 50 56
all_firms 1991 32 61 87
end
sort com year
gen foo=.
forv i = 1/2 {
replace foo = var1/var1[`i'] if year ==`=1989 + `i''
}
Scott
*
* 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/