Statalist


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

st: using computed results in an immediate command


From   Michael Eisenberg <michael.eisenberg@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: using computed results in an immediate command
Date   Wed, 6 May 2009 09:32:25 -0700

Dear all,

I am attempting to create a do file to calculate means of several
variables and then use these values in the csi command.

sum stots if heart==1
scalar a1 = r(mean)
sum stots if heart==0
scalar b1 = r(mean)
sum stotd if heart==1
scalar c1 = r(mean)
sum stotd if heart==0
scalar d1 = r(mean)

csi a1 b1 c1 d1

I get an error that " 'a1' found where integer expected."

I'm not sure using scalars is the right way to accomplish this task.
Is there a way to use the computed results like r(mean) is immediate
commands?

If not, can anyone think of a way to do this without having to type in
the individual numbers.

Thank you.

Mike

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