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
fixed effects specification: dummies (LSDV) vs within estimatorHello everyone, I have a question on the various specifications of a fixed effect model. I always …
Help with linear approximate ideal demand system (LA-AIDS/L-AIDS)Hi everyone, I have a time series data where there are several variables given.For example, disappea…
using a separate time variable and am/pm indicator variable to generate a military time variableHi, I briefly dug into this and could not find an answer. I have 3 variables: a date variable, a ti…
quasi-panel made out of cross-sectional dataHi all, Does anybody know how to create a quasi-panel data out of the cross-sectional data. I have a…
Impostare parametri inizialiGood morning I open this thread to ask if in Stata it is possible to create initial parameters (to c…
Subscribe to:
Post Comments (Atom)
0 Response to Use a for-loop to generate dummy variables
Post a Comment