[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Sergiy Radyakin" <serjradyakin@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Code |

Date |
Tue, 22 Jul 2008 15:49:37 -0400 |

Dear Ana, probably something like this to get started: sysuse auto, clear sort price local price_line=5079 /* 228.22 */ local window=5 tempvar obsnum gen `obsnum'=_n sum `obsnum' if price==`price_line' sum price in `=`=r(min)'-`window''/`=`=r(max)'+`window'' Note that there might be more than 1 household right at the level of poverty line. The above code will take all of them, plus window households on the sides Also note that a concept of "being at the poverty line" sounds strange. Typically there are poor (inc<povline) and non-poor (inc>=povline) households. Also the chances of a household having income exactly equal to the poverty line are rather low. Also avoid direct comparison (income==value) since income is stored as decimals, and you may run into precision problems if your poverty line is not a round number, but rather generated automatically in your code, etc, etc, etc. Just in case: ADePT Poverty program will do a lot of standard poverty tabulations: www.worldbank.org/adept Best regards, Sergiy Radyakin On 7/22/08, Ana R. Rios <arorigal@yahoo.com> wrote: > Dear Stata users, > > Could someone suggest a code that will perform the following? > - I have defined a poverty level based on income per capita (incpc). I would like to perform calculations on x number of households above/below poverty. > > Here is an example: lets assume that the poverty level is an income per capita equal to 228.22. I would like to calculate the mean income per capita for a total sample of 11 households: 5 households above poverty, 5 households below povery and the household at the poverty level. That is, the mean income per capita for observations 8 to 18. > > obs househol incpc > 1 18109 15.87111 > 2 19705 52.32142 > 3 37503 75 > 4 25309 80 > 5 33520 91.14099 > 6 22905 100 > 7 4113 150 > 8 37520 167.7384 > 9 33102 190 > 10 28614 192.205 > 11 28504 227.3124 > 12 37616 227.3575 > 13 37620 228.22 > 14 33518 235.8528 > 15 33315 236.0431 > 16 4205 250 > 17 5210 250 > 18 23814 252.6725 > 19 28506 256.8579 > 20 30912 265 > > > Thank you for your time. > > Regards, > Ana Rios > > > > > * > * 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/

**Follow-Ups**:**Re: st: Code***From:*rraciborski@gmail.com

**References**:**st: Code***From:*"Ana R. Rios" <arorigal@yahoo.com>

- Prev by Date:
**Re: st: Suppress a legend in overlaid twoway graphs** - Next by Date:
**Re: st: Code** - Previous by thread:
**st: Code** - Next by thread:
**Re: st: Code** - Index(es):

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