[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: -encode- help..

From   "Martin Weiss" <>
To   <>
Subject   st: Re: -encode- help..
Date   Wed, 19 Nov 2008 20:52:30 +0100

Well, if they share the same values, then the -encode- will lead to a redundancy because technically you would need only one -label- so that

webuse hbp2, clear

forv i =1/5{
clonevar sex`i'=sex

encode sex, g(gender)

ds sex?

foreach var in `r(varlist)'{
encode `var', g(gender`var') l(gender)


you can reuse it with the -label- option to -encode-...

----- Original Message ----- From: "moleps islon" <>
To: <>
Sent: Wednesday, November 19, 2008 8:30 PM
Subject: st: -encode- help..

I've got 30 different text variables that all have the same possible
values. Is there an easy way to encode all 30 variables using the same
label or do I have to do it manually. Also is it possible, somehow, to
specify stata to start encoding with tha value 0 instead of 1 ?

Best wishes,
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index