Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: More elegant code . . .?


From   Michael Costello <[email protected]>
To   statalist <[email protected]>
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index