Dr. Veit Grote <[email protected]> wrote:
> I am using Stata 8.2 (up to date) and have two problems with - recode -:
>
> 1. Can I somehow label within - recode - as I have tried below:
> recode alter_j (min/1=1 "0-1 Jahr") (1/4=2 ">1-4 Jahre") (4/10=3 ">4-10
Jahre") (10/16=4 ">10-16 Jahre") ///
> gen(alter_cat2) label(alter_cat2)
>
> 2. Why do I get the error code "r(110)" after the following - recode -. I
have a very regular do-file with -generate-, - replace- and -recode- before
this error appears:
>
> recode alter_m min/3=1 3/6=2 6/9=3 9/12=4 12/18=5 18/24=6, gen(alter_cat)
> __000000 already defined
> r(110);
Dr. Grote was kind enough to send his data to Stata Technical Services so
that we could track down the problem he was having with the -recode-
command. It turns out that the reason he was receiving the error "__000000
already defined" was because his dataset already contained a variable named
__000000. This variable was most likely a tempvar he created that was
accidentally or inadvertently saved to his dataset.
The second error he was receiving was due to a missing comma before
the -generate()- option of -recode-. For example,
. clear
. set obs 26
obs was 0, now 26
. gen alter_j = int(uniform()*16 + 1)
. recode alter_j (min/1=1 "0-1 Jahr") gen(alter_cat2) label(alter_cat2)
Value label not allowed
r(198);
. recode alter_j (min/1=1 "0-1 Jahr"), gen(alter_cat2) label(alter_cat2)
(0 differences between alter_j and alter_cat2)
Kevin
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/