*FAIS Y FISM 2013 NORMAL. SE ACTUALIZA LA NORMA DE INGRESO Y EL INPC* *BASE JUNIO DE 2010 * *Stata 12 * ********************************************************************* #delimit; clear; set more off; cap log close; gl personas = "C:\Microdatoscenso_2010\poblacion"; gl viviendas = "C:\Microdatoscenso_2010\Vivienda"; gl temp = "C:\Microdatoscenso_2010\Temp_2013"; gl tempe = "C:\Microdatoscenso_2010\Temp_2013\Excel"; log using "$temp\FAIS_2013.smcl", replace; *Indicadores de personas; foreach x in "01" "02" "03" "04" "05" "06" "07" "08" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" {; use "$personas\personas_`x'.dta", clear; destring clavivp edad alfabet escoacum, replace; drop if clavivp>=5 & clavivp<=7; recode edad (999=.); *Nivel educativo promedio del hogar; *Analfabetismo; rename alfabet analf; replace analf=0 if analf==3; replace analf=. if analf==9; *Nivel educativo de la persona; recode escoacum (99=.); gen norma=.; replace norma=escoacum/1 if edad==7 | edad==8; replace norma=escoacum/1 if edad==9; replace norma=escoacum/2 if edad==10; replace norma=escoacum/3 if edad==11; replace norma=escoacum/4 if edad==12; replace norma=escoacum/5 if edad==13; replace norma=escoacum/6 if edad>=14 & edad!=.; gen nei=.; replace nei=norma if edad>=7 & edad<=9; replace nei=norma*analf if edad>=10 & edad!=.; *Brecha educativa; gen b_educativa=.; replace b_educativa=1-nei if (edad>=7 & edad!=.) & nei!=.; *Ajuste de la brecha educativa; replace b_educativa=b_educativa/(7.334) if b_educativa<0; collapse (mean) b_educativa, by(ent mun id_viv); sort ent mun id_viv; save "$temp\b_educativa_`x'.dta", replace; *Indicadores de ingreso y vivienda; use "$viviendas\viviendas_`x'.dta", clear; destring clavivp numpers ingtrhog, replace; drop if clavivp>=5 & clavivp<=7; *Ingreso promedio del hogar. Se acutalizan los ingresos con el INPC INEGI; recode ingtrhog (999999=.); gen ingreso11=ingtrhog*1.077537; gen ingpc=ingreso11/numpers; *Línea de pobreza alimentaria rural CONEVAL Junio 2012; scalar lp=877.98; gen b_ingreso=(lp-ingpc)/lp; *Reescalamiento del ingreso; replace b_ingreso=b_ingreso/18 if b_ingreso>=-9 & b_ingreso<0; replace b_ingreso=-0.5 if b_ingreso<-9; *Disponibilidad de espacio de la vivienda; destring cuadorm, replace; recode cuadorm (99=.); gen dej=(cuadorm*3)/numpers; *Reescalamiento de la disponibilidad de espacio de la vivienda; replace dej=dej*(1.5/75) + (1-(dej/75)) if (dej>1 & dej!=.); *Brecha de espacio de la vivienda; gen b_espacio=1-dej if dej!=.; *Disponibilidad de drenaje; destring drenaje, replace; gen d1=.; replace d1=1.5 if drenaje==1; replace d1=1.0 if drenaje==2; replace d1=0.5 if drenaje==3; replace d1=0.3 if drenaje==4; replace d1=0.0 if drenaje==5; *Brecha por disponibilidad de drenaje; gen b_drenaje=1-d1; *Disponibilidad de electricidad; destring electri combus, replace; recode electri (3=0) (9=.); gen c=.; replace c=1.0 if elec==1; replace c=1.0 if (combust==1 | combust==2) & elec==0; replace c=0.1 if (combust==3 | combust==4) & elec==0; *Brecha de electricidad o combustible; gen b_electricidad=1-c if c!=.; *Se seleccionan las variables de interés; keep ent nom_ent mun nom_mun id_viv b_* ingreso11 ingpc factor numpers; *A las bases de vivienda por estado se les incluye la información de indicadores de personas; sort ent mun id_viv; merge ent mun id_viv using "$temp\b_educativa_`x'.dta"; drop _merge; *Índice global de pobreza de un hogar; gen igp=(b_ingreso*0.4616) + (b_educativa*0.1250) + (b_espacio*0.2386) + (b_drenaje*0.0608) + (b_electricidad*0.1140); *Población en situación de pobreza extrema; gen p_ext=1 if igp>=0 & igp<=1; *Masa carencial del hogar; gen mch=.; replace mch=(igp^2)*numpers if p_ext==1; *Masa carencial estatal y municipal; egen mcmf=sum(mch*factor), by(mun); egen mcef=sum(mch*factor), by(ent); *Bases a nivel estatal; save "$temp\estatal_`x'.dta", replace; collapse (mean) mcef mcmf, by(ent nom_ent mun nom_mun); *Tabulado a nivel municipal; gen pcm=mcmf/mcef; export excel ent nom_ent mun nom_mun mcmf pcm using "$tempe\FISM_2013_`x'.xls", sheet("fism_`x'") firstrow(variables) replace; save "$temp\fism_`x'.dta", replace; }; #delimit; *Base nacional; use "$temp\fism_01.dta", clear; foreach y in "02" "03" "04" "05" "06" "07" "08" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" {; append using "$temp\fism_`y'.dta"; }; tab ent; *Tabulado a nivel Estatal; egen mcnf=sum(mcmf); gen pce=mcef/mcnf; export excel ent nom_ent mun nom_mun mcmf pcm using "$tempe\FISM_2013.xls", sheet("FISM_2013") firstrow(variables) replace; collapse (mean) mcnf mcef pce, by(ent nom_ent); export excel ent nom_ent mcnf mcef pce using "$tempe\FAIS_2013.xls", sheet("dist_2013") firstrow(variables) replace; save "$temp\FAIS_2013.dta", replace; log close;