The quotes are required if we need to force Stata to evaluate the contents of r(), where it otherwise would not. In this situation, they are not necessary as -display- evaluate the expression. Suppose instead we tried the following (nonsensical):
. sysuse auto
(1978 Automobile Data)
. kwallis price, by(foreign)
{output omitted}
. tabi r(df) 2 \ 3 4
'r' found where integer expected
r(7);
In this case Stata was expecting an integer, and did not evaluate r(df) to find the value 1. Now we do need the quotes:
. kwallis price, by(foreign)
{output omitted}
. tabi `r(df)' 2 \ 3 4
| col
row | 1 2 | Total
-----------+----------------------+----------
1 | 1 2 | 3
2 | 3 4 | 7
-----------+----------------------+----------
Total | 4 6 | 10
Fisher's exact = 1.000
1-sided Fisher's exact = 0.667
Hope this helps
David
-----Original Message-----
From: Ken Clark [mailto:[email protected]]
Sent: 02 June 2005 11:23
To: [email protected]
Subject: st: RE: save p-values from Kruskal-Wallis-test
Dear All
On yesterday's list, Gerhard Schoen asked about p-values for the
Kruskal-Wallis test. David Harrison replied suggesting
. display chi2tail(r(df), r(chi2))
while Kieran McCaul suggested
. display chi2tail(`r(df)', `r(chi2)')
That is, Kieran puts single quotes (presumably denoting a local
macro) around the returned results.
My questions is simply whether, or under what circumstances, this
second usage is better? Would it ever give a different answer to
the first usage?
Thanks
Ken
Ken Clark
School of Economic Studies
University of Manchester
Manchester
M13 9PL
Tel:0161-275-3679
Fax:0161-275-4812
email: [email protected]
http://www.ses.man.ac.uk/clark
*
* 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/