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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: using computed values with the immediate command |

Date |
Thu, 7 May 2009 01:13:45 +0200 |

<>

-confirm integer number 2- which passes the test and -confirm integer number 2.0- which does not... Here is an example to play around with for those who are interested: *** clear* set obs 100 gen x=cond(_n<=_N/2,0,1) gen y1=cond(_n<=_N/2,1,3) gen y2=cond(_n<=_N/2,3,5) sum y1 if x==1, mean local a1 = round(r(mean),0) // round to create integers sum y1 if x==0, mean confirm integer number `r(mean)' di in red _rc loc b1=r(mean) /*local b1 = round(r(mean),0) */ sum y2 if x==1, mean local c1 = round(r(mean),0) sum y2 if x==0, mean local d1 = round(r(mean),0) // set tr on csi `a1' `b1' `c1' `d1' *** HTH Martin _______________________

To: <statalist@hsphsun2.harvard.edu> Sent: Thursday, May 07, 2009 12:54 AM Subject: Re: st: using computed values with the immediate command

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/

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

**References**:**st: using computed values with the immediate command***From:*Michael Eisenberg <meisenberg713@gmail.com>

**Re: st: using computed values with the immediate command***From:*David Elliott <dcelliott@gmail.com>

- Prev by Date:
**st: St: Ordered Logit Question** - Next by Date:
**st: Why don't my IRs and Cox HRs echo each other?** - Previous by thread:
**Re: st: using computed values with the immediate command** - Next by thread:
**st: using computed results in an immediate command** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |