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
Weighted Sum in CollapseHi, I am working with firm-level data (cross-section data). I am trying to calculate the weighted s…
Trying to save collapsed files - invalid file specification errorHello, I am trying to collapse all files in a folder and replace the old files with the new ones. S…
Custom one-tailed confidence intervals for coefplotI'm using the community-contributed command from SSC coefplot. The command is described here: http:…
Bar graph troubleArray Code: graph bar (percent), by(year) over(wbsat) over(white) title(SWB) I am trying to make …
Interpretation of interaction with time in FE modelDear all, Would you help me to interpret the following models? This is 5 waves data with time-vary…
Subscribe to:
Post Comments (Atom)
0 Response to Loop with the command usespss in Stata 16
Post a Comment