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
how to access STATA 16 sever through MAC terminalCurrently, I successfullly installed Stata on my server and can use "./stata" to initiate the progra…
FD-GMM vs sys-GMMDear all. Which kind of GMM method should I use to dynamic panel data? FD-GMM or sys GMM?Some people…
Question about datesI had a question about dates. Can someone suggest an efficient method to deal with this type of date…
Stacked graph bar with marginsplot ?Good morning everyone! I need your help for plotting the results of margins in a nice and straightf…
Extract Year from a string variableHi everyone, I would like to ask some help in order to extract year from a string variable (year of …
Subscribe to:
Post Comments (Atom)
0 Response to Use a for-loop to generate dummy variables
Post a Comment