Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re[2]: st: Problem with foreach loops


From   Richard Williams <Richard.A.Williams.5@ND.edu>
To   statalist@hsphsun2.harvard.edu, Richard Williams <statalist@hsphsun2.harvard.edu>
Subject   Re[2]: st: Problem with foreach loops
Date   Mon, 07 Jun 2004 06:22:49 -0500

At 06:35 PM 6/7/2004 +1000, Ian Watson wrote:
I've also checked -recode-, and while the manual shows how multiple
variables can be recoded in one statement, there is no example of how
one might implement the -gen- option for multiple variables. Perhaps
someone on the list knows the trick?
Perhaps I misunderstand you, but isn't this example from the online docs (which might be more current than the manual) what you mean?

recode x1 x2 (1 2 3/5=1) (6/10=2), gen(nx1 nx2)

In the case of your original example (following is meant to be all one line)

recode ajbmspay ajbmssec ajbmswrk ajbmshrs ajbmsflx ajbmsall(-4 -3 -1=.), gen(a_pay a_security a_work a_hours a_flexibility a_overall)

*
* 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/




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