You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
350 B
Plaintext

program define dege
syntax anything [, i(string)]
preserve
if "`i'"=="" {
local i ind
}
qui reshape long `anything',i(`i') j(item)
qui rename `anything' response
qui inspect item
local nbvalues=r(N_unique)
forvalues j=1/`nbvalues' {
qui gen `anything'`j'=item==`j'
qui replace `anything'`j'=-`anything'`j'
}
restore,not
end