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
Weak IV test postestimation test when using ivreghdfe command?Dear STATA community, I am hoping you can help me find a command I am looking for. My coauthor and …
Generate a moving window averageIs there an easy way to generate a moving window average? For instance, for every 5 minutes of Ta_NO…
Calibration of logistic regression on large dataset.Evaluating goodness-of-fit for a logistic regression model using the Hosmer-Lemeshow test is not rel…
Guarantee 3 consecutive observations before and after the eventDear Stata Users, I need to keep just those firms (gvkey) that have 3 year consecutive observations…
Can I use tssmooth for a fixed number of periods like a rolling forecast, safe the forecast t+5, then start in t+1, save forecast t+6...Hello everybody, I'm trying to forecast values for the strategy of companies. I have a panel datase…
Subscribe to:
Post Comments (Atom)
0 Response to Converting Composite Categorical Variables to Binary Variables
Post a Comment