Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Why aren't commands displayed within a foreach-loop


From   "Kieran McCaul" <kamccaul@meddent.uwa.edu.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Why aren't commands displayed within a foreach-loop
Date   Wed, 21 Nov 2007 13:00:36 +0900

While we are on this, does anyone know why the commands aren't
displayed?

______________________________________________
Kieran McCaul MPH PhD
WA Centre for Health & Ageing (M573)
University of Western Australia
Level 6, Ainslie House
48 Murray St
Perth 6000
email: kamccaul@meddent.uwa.edu.au
http://myprofile.cos.com/mccaul 
_______________________________________________

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Thorsten Faas
Sent: Tuesday, 20 November 2007 5:06 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: display commands generated within foreach-loop

Dear all,

I'm sure my problem has a real simple solution, but I am unable to find 
it - how can I actually *see* the commands generated by a foreach-loop.

Let's say I have the following:

preserve
sysuse auto, clear
foreach x in "mpg" "price" {
	ttest `x', by(foreign)
}
restore


In this case, I would like to see

ttest mpg, by(foreign)

... output ...

ttest price, by(foreign)

... output ...

in my logfile, but I don't. All I see is the output of the T-test.

Any suggestions highly appreciated!

Regards
Thorsten


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



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