Hi all,
I'm new to Stata and am running into trouble with setting up a dataset for use.
The issue is that I have a composite categorical variable, with multiple entries per observation that are separated by commas (e.g., "A,B,C"). Each entry is a single word, but as answers were written in, there are a great many different entries. My goal is to convert this variable into a series of binary variables, each taking the name of an entry, and taking a value of 1 if the particular word was present in the original variable.
I have tried following the advice given for a similar topic here, but have been unable to successfully adapt it to my case.
Any advice would be greatly appreciated!
Best,
Ben
Related Posts with Converting Composite Categorical Variables to Binary Variables
Help ReshapingHi, I am trying to reshape the data so I have just four columns, name code year and Alevels. My data…
Create a rank variable mpg rank 12 1 12 1 14 2 14 2 14 2 15 3 15 3 16 4 17 5 I want to create a ran…
Separate observations depending on their value in one variableHi all, I have a dataset with many variables that indicate people and certain characteristics, but …
Parallel foreach?To improve speed I would like to parallelize a loop of this kind: Code: global myvars v1 v2 v3 fo…
Query about command "arima"Hello I am using the arima command to estimate an ARMA process. My query is about the the constant …
Subscribe to:
Post Comments (Atom)
0 Response to Converting Composite Categorical Variables to Binary Variables
Post a Comment