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
Problems with fmm package and streg packageHello, I am doing a parametric survival analysis with a loglogistic baseline hazard function. I wil…
xtabond2: Interaction endogenous and exogenous variableHello everyone, This is my first post here. I have a question about the xtabond2 command. I would …
Analysis of an interrupted stepped wedge cluster RCTDear All, I am part of a team conducting a stepped wedge cluster randomised control trial to improv…
How to correctly use and interpret interaction terms in panel datasetDear Stata Community, First of all I wanted to say hi as I am new here and to express my gratitude …
How to export multiple tables outputted from a single Stata commandI am running Stata code which gives two tables from a single command. I wish to export the first of …
Subscribe to:
Post Comments (Atom)
0 Response to Question of replace
Post a Comment