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
How can i plot estimates of 3 different models (and each model has multiple estimates for time observations)?Hi everyone. I'm running 3 foreach loops to estimate 3 different models (they share some coefficient…
Question about reghdfe commandDear all, I have a question about the command reghdfe(version 6). What is the difference between the…
How are cut points calculate in ordered logistic regression?Is there a formula available for how Stata calculates the cut points in ordered logistic regression …
adding two arguments in inlist function Hi everyone, I have the following table, which has two separate columns for immig 1 & 2 (1: Imm…
Generating variables and compute average with if conditionsDear all, I’m new to stata and for my research I need the following: I have two treatments: 1) Focus…
Subscribe to:
Post Comments (Atom)
0 Response to How to Categorize float variable
Post a Comment