Statalist


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

Re: st: using computed values with the immediate command


From   David Elliott <[email protected]>
To   [email protected]
Subject   Re: st: using computed values with the immediate command
Date   Wed, 6 May 2009 19:54:06 -0300

Stata is telling you what is wrong.  It has nothing to do with not
being able to store values.  I assume since you are asking for r(mean)
after -summarize- that you are saving a scalar float with several
decimal places.  However,  -csi- the routine expects an integer based
on count data.

The following will probably be complete nonsense statistically but
illustrates the point:
sum stots if heart==1
local a1 = round(r(mean),0) // round to create integers
sum stots if heart==0
local  b1 =  round(r(mean),0)
sum stotd if heart==1
local  c1 =  round(r(mean),0)
sum stotd if heart==0
local  d1 =  round(r(mean),0)
csi `a1'  `b1'  `c1'  `d1'

Giving csi a scalar, even if it is an integer, doesn't work.  Contrast
the results of:
-csi 2 4 6 8-  versus  -csi 2.0 4.0 6.0 8.0-


D. C. Elliott

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index