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

st: Programming FGT using weights


From   "Yanina Lewit" <[email protected]>
To   <[email protected]>
Subject   st: Programming FGT using weights
Date   Mon, 3 May 2004 19:19:17 -0300 (GMT-3)

Hello:
I�m using data of Argentina�s household survey. I�m defining a program for
calculate FGT. I have different poverty lines (zetane, zetacu, zetagba,
zetano,zetapam, zetapat )in differents states of the country diffing by
the variable region. This work perfectly coherent with other results I got
using stata.
The point is I want to calculated this program using weights, and It
wasn�t possible to me to modify this program for using them. Does someone
could help me?
best regards
Yanina


Here is the program I�m using under stata version 6.0



capture program drop fgtreg

program define fgtreg, rclass

syntax varlist(max=1), alfa(real) zetane(real) zetacu(real) zetagba(real)
zetano(real) zetapam(real) zetapat(real)
quietly {

tempvar each suma

gen `each'=.

gen `suma'=.

replace `each'=1*(1-`varlist')/`zetane')^`alfa' if region==41
&`varlist'<`zetane'

replace `each'=1*(1-`varlist'/`zetacu')^`alfa' if region==42
&`varlist'<`zetacu'

replace `each'=1*(1-`varlist'/`zetagba')^`alfa' if region==1
&`varlist'<`zetagba'

replace `each'=1*(1-`varlist'/`zetano')^`alfa' if region==40
&`varlist'<`zetano'

replace `each'=1*(1-`varlist'/`zetapam')^`alfa' if region==43
&`varlist'<`zetapam'

replace `each'=1*(1-`varlist'/`zetapat')^`alfa' if region==44
&`varlist'<`zetapat'

replace `suma'=sum(`each')

local fgtreg=`suma'[_N]/_N
return scalar fgtreg = `fgtreg'
}

display in yellow "FGT `varlist'= `fgtreg'"

end





*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index