Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: More elegant code . . .?


From   Michael Costello <michaelavcostello@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: More elegant code . . .?
Date   Sat, 4 Jun 2011 19:18:11 -0400

Statalisters,

I have some code that I would like to make more elegant (shorter,
while still fitting on one line):
recode letter_auto_stop 0=1 if letter1==0 & letter2==0 & letter3==0 &
letter4==0 & letter5==0 & letter6==0 & letter7==0 & letter8==0 &
letter9==0 & letter10==0

The line above works, but it's bulky.  I'd like to find something
better to use.  I tried:
recode letter_auto_stop 0=1 if letter1-letter10==0

but stata treated it as "recode letter_auto_stop 0=1 if letter1==0 &
letter10==0" ignoring letter2 through letter9 entirely.

Thanks for any help you can provide!
-Michael

--
Michael Costello
Mathematics & Statistics Teacher, Bethesda-Chevy Chase High School
Intern, RTI International

"To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of."  -Sir Ronald Aylmer Fisher,
FRS

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index