Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • create variable

    Good Morning
    I am working with probit bivariado on child labor and schooling. I want to create a variable of poverty in the following way: very poor, poor, medium, good, very good. The line of poverty is 387 real and minimum wage is 945. I did

    g very poor =(v4622==0) if rendi<=15
    g poor = (v4622==1) if rendi>=15 & rendi<387
    g medium = (v4622==3 | v4622==4) if rendi>=387 & rendi<954
    g good = (v4622== 5 | v4622==6) if rendi<=954 & rendi<3000
    g very good = (v4622==7) if rendi>=3000 & rendi<=30000
    tab pobre, missing

    And also

    *g poor=.
    *replace poor= v4622-1 if v4622!=99
    *tab v4622 poor, missing

    *g very_poor=.
    *replace very_poor=0 if rendi<=15
    *replace very_poor=1 if rendi>=15 & rendi<387
    *replace very_poor=4 if rendi>=387 & rendi<954
    *replace very_poor=6 if rendi>=954 & rendi<3000
    *replace very_poor=7 if rendi>=3000 & rendi<=30000
    *tab poor very_poor, missing

    *Variável binária poor para 15<=rendi<=387 pegando so ultimos valores,ou seja, 5 e 7

    *g poor57=0
    *replace poor57=1 if rendi>=15 & rendi<387
    *tab very_poor poor57, missing

    *Variável binária medium para 387>=rendi<954
    *gen poor74=0
    *replace poor74=4 if rendi>=387 & rendi<954
    *tab very_poor poor74, missing

    *Variável binária good para 954<=anest<=3000
    *gen poor43=0
    *replace poor43=6 if rendi>=954 & rendi<3000
    *tab very_poor poor43, missing

    *Variável binária very good para 3000<=anest<=30000
    *gen poor33=0
    *replace poor33=7 if rendi>=3000 & rendi<=30000
    *tab very_poor poor33, missing

    but this the result is not good. Please Help

    Thank you
    Last edited by ABDOULAYE ABOUBACARI MOHAMED; 20 Jun 2018, 10:45.

  • #2
    Abdoulaye:
    welcome to this forum.
    I'm not clear with what you're after and why you followed so many approaches for creating such a variable.
    Anyway, you may want to try:
    Code:
    g poor=0 if rendi<=15
    replace poor=1 if rendi>15 & rendi<=387
    replace poor=3 if rendi>387 & rendi<=954
    replace poor=5 if rendi>954 & rendi<=3000
    replace poor=7 if rendi>3000 & rendi<=30000
    
    label define poor 0 "very poor" 1 "poor" 3 "medium" 5 "good" 7 "very good"
    
    label val poor poor
    Kind regards,
    Carlo
    (StataNow 19.0)

    Comment

    Working...
    X