Dear statalist,
Can anyone spot the mistake with the following snippet of code.
It actually works fine, and recodes and labels the variable
in the way I wish, but in exiting (?) the loops it runs into problems.
Any advice would be most appreciated.
begin snippet==================
foreach x in ajbmspay ajbmssec ajbmswrk ajbmshrs ajbmsflx ajbmsall {
. foreach y in pay security work hours flexibility overall{
. recode `x'(-4 -3 -1=.), gen(a_`y')
. la var a_`y' "Satisfaction with `y'"
. }
}
(5475 differences between ajbmspay and a_pay)
(5475 differences between ajbmspay and a_security)
(5475 differences between ajbmspay and a_work)
(5475 differences between ajbmspay and a_hours)
(5475 differences between ajbmspay and a_flexibility)
(5475 differences between ajbmspay and a_overall)
a_pay already defined
r(110);
end snippet=========================
--
Kind regards,
Ian
=================================
Ian Watson
Senior Researcher
acirrt
University of Sydney
NSW 2006
Australia
Phone: 02 9351 5622
Fax: 02 9351 5615
Email: [email protected]
Web: www.acirrt.com
================================
*
* 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/