Hello,
I wanted to create an indicator variable combining two or more categorical variable. So for one of my variables i want to combine the variable gender (female=1 and male=0) and race (white=1, black=2, Hispanic=3 and other=4) to create 12 variables. Generally, when i create indicator variables using one categorical variable, i usually do one of the three options: manually generate variable or tabulate with generate ( ) or make a loop with the generate command. I tried to do this using 2 variables using the second or third method, but i kept getting an error from STATA. Is there an easy way to generate indicator variables using 2 or more categorical variables?
Related Posts with Creating indicator variables from multiple categorical variable
Two digit year to four digit year for date makingHello Statalist, I need to use "gen start_date = mdy(month, day, year)" to get a date var. However, …
egen command not workingMy egen and count command is not working although I tried it with ssc install egen but it's still no…
Changing the order of bars in a box plotHi! I want to make a box plot of distribution of 6 different scores (score 1-6) by a grouping varia…
Find old ROE for EXECID commandsHello, Thank you in advance for helping. I am new to Stata. I am replicating a study and therefore…
Make a new group variable of a variableHi! I probably got a simple problem. Let us say I got a variable, called States, with numbers from …
Subscribe to:
Post Comments (Atom)
0 Response to Creating indicator variables from multiple categorical variable
Post a Comment