I would like to create a variable that takes a name of a value in particular cell. For example my data set looks like this
var1 count
xx 1
xc 2
xv 3
xj 4
I would like to create 4 new variables that take names from the values of the variable var1. For example, three variables would be xx xc xv xj. I understand reshape would do this but in my case I don't want to use reshape. I tried the code below
forvalues i =1/4{
local d var1 count ==`i'
gen xx_`d'= .
}
xx_dalready exists. Check outhelp separate. - Nick Coxcountersupposed to be the same ascount? - Nick Cox_n: means nothing to me either. I don't get what you want. - Nick Cox