Hi all,

I am trying to generate Dummy variables from a question with multiple responses. Lamentably I am getting a problem with reshape command. example:

Code:
clear all
set more off
input str90 respuesta
"Diagnostico"
"Evaluacion"
"Tratamiento"
"Acompañamiento de niños"
"Acompañamiento de apoderados"
"Tratamiento, Evaluacion"
"Tratamiento, Diagnostico"
"Diagnostico, Evaluacion"
"Diagnostico, Evaluacion, Tratamiento"
"Diagnostico, Evaluacion, Acompañamiento de apoderados, Acompañamiento de niños"
"Diagnostico, Tratamiento"
"Diagnostico, Tratamiento, Acompañamiento de apoderados"
end

gen id=_n

replace respuesta= trim(itrim(ltrim(respuesta)))

split respuesta, generate(v) parse(, " ") trim

reshape long v, i(id) j(num)
drop if missing(v)
drop num
generate one = 1

reshape wide one, i(id) j(v) string

(note: j = Acompañamiento Diagnostico Evaluacion Tratamiento apoderados de niños)
values of variable v not unique within id
    Your data are currently long.  You are performing a reshape wide.  You specified i(id) and j(v).  There
    are observations within i(id) with the same value of j(v).  In the long data, variables i() and j()
    together must uniquely identify the observations.

I tried with:

bys id: gen newid=_n
reshape wide one, i(id) j(newid)

variable v not constant within id
    Your data are currently long.  You are performing a reshape wide.  You typed something like

Pd: My commands post the reshape:
Code:
foreach v of varlist one* {
    replace `v' = 0 if `v'==.
    }
rename (one*) (*)
Thanks in advance
Rodrigo