My dataset contains a varible of sex, the formate of which is string and the value of which contain male and female. I want to replace male with 1, and female with 0, so I write command as follows, but just get such results:
1. replace sex=1 if sex=="male"
type mismatch
2. replace sex=1 if sex="male"
invalid syntax
so what is the problem and how to correct it?
Thanks so much for answering
Related Posts with Question of replace
Temporary file disappears while running ado-code in Stata 16.0THIS MESSAGE WAS DESCRIBING THE PROBLEM, WHICH TURNED OUT NOT A BEING A SUSPECTED BUG, AND WAS EXPLA…
Industry and year fixed effects with standard errors clustered at firm levelHi I have a panel dataset and am trying to carry out a regression with industry and year fixed effe…
KHB: Summary of Confounding with Averarge Partial Effects (ape)Dear Statalisters, I hope you can help me with the following question, that I have regarding the kh…
Z-Score ProblemHi there, I have 2 dependent variables, and they need to be z-transformed because i need to compare…
cluster standard errors at firm level and year level in 2SLSI am running my baseline regressions using OLS method with Petersen (2009) two-dimensional clustered…
Subscribe to:
Post Comments (Atom)
0 Response to Question of replace
Post a Comment