Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Radwin, David" <dradwin@rti.org> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: I keep getting this error message: the number of new and transformed varnames should be the same |
Date | Thu, 1 Aug 2013 18:26:33 -0400 |
I think the problem is the space in gen(young cohort), which perhaps should be gen(young_cohort). Stata is expecting a single variable inside the parentheses. Incidentally, depending on exactly what the values are for VCF0101, you might find it more efficient to write . recode VCF0101 17/20=1 21/99=0, gen(young_cohort) David -- David Radwin Senior Research Associate Education Studies Division RTI International 2150 Shattuck Ave., Suite 800 Berkeley, CA 94704 Phone: 510-665-8274 www.rti.org > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- > statalist@hsphsun2.harvard.edu] On Behalf Of Jason W > Sent: Thursday, August 01, 2013 3:20 PM > To: statalist@hsphsun2.harvard.edu > Subject: st: I keep getting this error message: the number of new and > transformed varnames should be the same > > > I have been working on a variable that lists the age of the respondents. > It runs from 17-99. I want to recode it > into a dummy variable where 17 to 21 equal 1 and the rest are zeroed out, > but I am > constantly getting this error message when I try to generate the dummy > variable: > > "the number of new and transformed varnames should be the same" > > What does this mean and how can I address it? > > > This is the command I tried to enter before getting the > error message: > recode VCF0101 17=1 18=1 19=1 20=1 21=1 22=0 23=0 24=0 25=0 > 26=0 27=0 28=0 29=0 30=0 31=0 32=0 33=0 34=0 35=0 36=0 37=0 38=0 39=0 40=0 > 41=0 > 42=0 43=0 44=0 45=0 46=0 47=0 48=0 49=0 50=0 51=0 52=0 53=0 54=0 55=0 56=0 > 57=0 > 58=0 59=0 60=0 61=0 62=0 63=0 64=0 65=0 66=0 67=0 68=0 69=0 70=0 71=0 72=0 > 73=0 > 74=0 75=0 76=0 77=0 78=0 79=0 80=0 81=0 82=0 83=0 84=0 85=0 86=0 87=0 88=0 > 89=0 > 90=0 91=0 92=0 93=0 94=0 95=0 96=0 97=0 98=0 99=0, gen(young cohort) > Thanks, > > - Jason Waguespack * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/