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
Using OLS for binary dependent variable and observations perfectly predicting outcomesHi Statalist, I am running OLS for binary dependent variable after facing so many difficulties achi…
Problem with meta forestplot nullrefline commandHi! I hope everyone is well! I meta-analyse Hazard ratios from epidemiological studies using the m…
R-square ChallengesI am currently studying the impact of BRI on economic growth of countries using Difference In Differ…
Create a table from value labelsHi, i am trying to save the value labels of a variable to write them into a file together with thei…
Exporting tabstat output to latexHi everyone, I'm working with COVID-19 data in order to study the effect of inequality on coronavir…
Subscribe to:
Post Comments (Atom)
0 Response to Loop with the command usespss in Stata 16
Post a Comment