I',m doing a university homework and I'm stuck with the next problem. I have four principal variables call YEARs (indicate how old is each person), BMI (body mass index of each person), COUNTRY (dummy, 0 por local people, 1 for foreign), anda YOR (year of residence for foreign). I want to watch if there is any effect in the years of residence, not only in foreing, but also in local people, so for local I'm using years as years of residence.In stata I typed the next commands:
gen COUNTRY2= (1-COUNTRY)
gen YOR_LOCALS = YEARS if COUNTRY == 0
gen CNTRY2xYORLOC = COUNTRY2 * YOR_LOCALS
reg IMC (adjustements variables) COUNTRY2 YOR CNTRY2xYORLOC YEARS
So I want to see:
B of years: effect of years in IMC
B of COUNTRY2: the constant difference between those born outside and those born inside. B of YOR: effect of years of residence on those not born in Spain.
B of CNTRY2xYORLOC: difference in the coefficient of years of residence between those born outside and those born inside
But every time I mix YOR with the interaction variable the fail error "no observations" appears. Any solution?
gen COUNTRY2= (1-COUNTRY)
gen YOR_LOCALS = YEARS if COUNTRY == 0
gen CNTRY2xYORLOC = COUNTRY2 * YOR_LOCALS
reg IMC (adjustements variables) COUNTRY2 YOR CNTRY2xYORLOC YEARS
So I want to see:
B of years: effect of years in IMC
B of COUNTRY2: the constant difference between those born outside and those born inside. B of YOR: effect of years of residence on those not born in Spain.
B of CNTRY2xYORLOC: difference in the coefficient of years of residence between those born outside and those born inside
But every time I mix YOR with the interaction variable the fail error "no observations" appears. Any solution?
Comment