I want to Categorize float variable which has letters as its elements.
Elements:
Horse, Camel, Car, Truck, Walk, Bus, Donkey.
I now want to categorize them into 1 for Animal. 0 for Non-animal.
I've tried to create a new variable
Mode_of_transport = 0
replace Mode_of_transport=1 if old_variable=="Horse"|old_variable=="Donkey"
It's giving me "mismatch"
any suggestions?
Related Posts with How to Categorize float variable
The F or chi2 model statistic has been reported as missingHi, I have a panel data for US listed firms for the years 2001-2019. I am trying to a model to dete…
Explanation of tabstat commandHello, I am a little confused when running the "tabstat" command. For example, I entered the comman…
How to mark weekday and weekend in time series plot?Hi everyone, I have a transaction dataset and I want to see if sales is different between weekday a…
Specify overall column and heterogenity statistic on forest plot in Stata 17Hello! I'm working in Stata 17 with the following meta set, declared as follows: meta set logrr lo…
How to construct loops doing something by group, with a Mata function inside the loop instead of a command?Good evening, Can somebody please show me how to calculate stuff by groups, when I am calling a Mat…
Subscribe to:
Post Comments (Atom)
0 Response to How to Categorize float variable
Post a Comment