I'm having a hard time generating dummy variables using a for loop. I have a variable with some values, now I want to create a dummy variable for each value such that if it takes the specific value it will return 1 otherwise it will return 0. I can't make it work since I always end up creating one new variable with all values being equal to 1. I have posted two pictures, the first one is the variable and the second one is how I want it to look like.
Array
I want it to look like this:
Array
Related Posts with Use a for-loop to generate dummy variables
PPMLHDFE useHello everybody, I am studying the impact of infrastructure on horticultural trade using a gravity …
Plot regressionHi all, After performing this regression: Code: reg loglprice c.yearquarter I would like to vis…
How to remove the graph background line?Hello, Good afternoon. I would like to look for some help: 1) I have no idea how to remove the backg…
generating tenure variableHi, I would like to create a variable that would track a tenure of executives (number of years with …
Marginal Effect for Bivariate Probit RegressionDear Statalist, I have question related to the calculation of marginal effects in a bivariate probi…
Subscribe to:
Post Comments (Atom)
0 Response to Use a for-loop to generate dummy variables
Post a Comment