I have a list of variables that contain answers Yes and No, I am trying to replace them with 1 and 0 and make all of them numeric
The command that I use is the following:
foreach var in MY LIST OF VARIABLES {
replace `var' = 0 if `var'==`No'
replace `var' = 1 if `var'==`Yes'
destring `var', replace
}
Stata responds "no variables defined". I would appreciate your help on this.
Thank you in advance!
Related Posts with Changing yes/no observations into 1/0
Question on Multiple ImputationHello, I have a question with regard to multiple imputation in Stata. The aim of my research is to …
TabulateHello how to request the frequency of several variables but in the same table. So in a way draw up a…
Descriptive statistics for all countries in the dataset by country and year.I have started to work on my data do-file for my thesis . I need to export descriptive statistics ta…
Specification in SEM builder for Multilevel SEMHello, I'm using Stata 15. Trying to figure out how to specify my model using SEM Builder. I can run…
question on Use logical expressions and sum()This question is from N. J. Cox's article: https://journals.sagepub.com/doi/pdf...867X1101100210. Se…
Subscribe to:
Post Comments (Atom)
0 Response to Changing yes/no observations into 1/0
Post a Comment