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
Issue Installing PyStataHello! I'm launching Stata from Jupyter notebook (using Anaconda) on a Mac. I'm following this guid…
Chow test statisticHi everyone! I tried doing a chow test using -test- and the following command: Code: . suest Brahmi…
Options starting with "no" doesn't work, bug or feature?I am defining a program that has non-required options. When the option starts with "no", it doesn't …
Creating different variables for firm-yearHi Statlist community, I have a dataset where I have different institutional investors for each yea…
Options starting with "no" doesn't work, bug or feature?I am defining a program that has non-required options. When the option starts with "no", it doesn't …
Subscribe to:
Post Comments (Atom)
0 Response to Question of replace
Post a Comment