Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: calculation within a panel


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: calculation within a panel
Date   Wed, 3 Feb 2010 15:21:30 +0100

<> 

Also not the use of the lag operator for "growth2":


*************
clear*

input byte( school_code  )    year   sch_lunch 
1  2000   1200  
2  2002   .
2  2003   400            
2  2000   300 
2  2001   500 
1  2001   1300    
end

compress

bys school_code (year): gen growth=sch_lunch[_n]/sch_lunch[_n-1]-1

tsset school_code year
gen growth2=sch_lunch /L.sch_lunch-1

list, noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Rodrigo Briceño
Gesendet: Mittwoch, 3. Februar 2010 15:10
An: [email protected]
Betreff: st: calculation within a panel

Dear Stata Users. I have a stata file with several variables for 500
schools in years 2000-2009.
One of this variables is the monetary allocation each school received
for school lunch program.
What I need is to estimate the growth rate of the allocation received
each period, but I have no
idea how to do that.

I'm using Stata 10 and windows XP.

Example:

school_code      year   sch_lunch  growth
1                      2000    1200          na
2                      2000      300          na
1                      2001    1300          0.083
2                      2001      500          0.666, etc.

thanks for your help
--
Rodrigo Briceño
Economist
+506  22-91-12-00 ext. 113   Office
+506  22-32-08-30                Fax
[email protected]

MSN: [email protected]
SKYPE: rbriceno1087

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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