Hi. I have to do the same calculations with some data sets in format .sav. I did this lines but they do not work.
set more off
global archivos_enemdu "ENEMDU_PERSONAS_2007_12_hom.sav ENEMDU_PERSONAS_2008_12_hom.sav ENEMDU_PERSONAS_2009_12_hom.sav ENEMDU_PERSONAS_2010_12_hom.sav ENEMDU_PERSONAS_2011_12_hom.sav ENEMDU_PERSONAS_2012_12_hom.sav ENEMDU_PERSONAS_2013_12_hom.sav ENEMDU_PERSONAS_2014_12_hom.sav ENEMDU_PERSONAS_2015_12_hom.sav ENEMDU_PERSONAS_2016_12_hom.sav ENEMDU_PERSONAS_2017_12_hom.sav ENEMDU_PERSONAS_2018_12_hom.sav ENEMDU_PERSONAS_2019_12_hom.sav ENEMDU_PERSONAS_2020_12_hom.sav ENEMDU_PERSONAS_2021_12_hom.sav"
foreach a of global archivos_enemdu{
usespss "ENEMDU_PERSONAS_`a'_12_hom.sav"
gen edad=.
replace edad=1 if p03>=0 & p03<=5
replace edad=2 if p03>=6 & p03<=11
replace edad=3 if p03>=12 & p03<=17
replace edad=4 if p03>=18 & p03<=29
replace edad=5 if p03>=30 & p03<=64
replace edad=6 if p03>=65
label define label_edad 1"Infantes" 2"Niños/as" 3"Adolescentes" 4"Jóvenes adultos" 5"Adultos" 6"Tercera Edad"
label values edad label_edad
}
Related Posts with Loop with the command usespss in Stata 16
Explaining output from replace commandThis uses the "sysuse auto" stata dataset. The command I was intending to type was replace price=1…
Exlogistic: getting OR and CI from return list or ereturn listDear Statalisters, Any advise on getting OR and 95%CI after use of exlogistic command directly for p…
More mathematical functions like sigma & integralHello everyone! I would like to draw more mathematical functions on Stata. I found following functi…
Generate a new variable by counting character ( "/" ) Code: . list country +------------------------------+ | country | …
Synth package error: file synthopt.plugin not foundI am very new to using this package and cannot get even one of the provided examples to work due to …
Subscribe to:
Post Comments (Atom)
0 Response to Loop with the command usespss in Stata 16
Post a Comment