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
Question: Generating summary statistics table with tabstat and tableDear all, I have recently attempted to generate a descriptive statistic table with the command Co…
Panel index within groupHey there, I like to create a new column indicating the occurrence of non-missing BAM within each id…
Time fixed effects as dummies change significanceDear Statalist, I am doing research on using nighttime light (radiances per area) to predict real re…
creating a loopHi guys: as you can see, below are four parts of repetitive codes, and the only difference is ccode2…
Fitting two lines using aaplotDear All, Is it possible to fit two lines (i.e. more than two variables) using the aaplot command? I…
Subscribe to:
Post Comments (Atom)
0 Response to Loop with the command usespss in Stata 16
Post a Comment