[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 |
st: RE: matrix out |

Date |
Sat, 12 Dec 2009 10:46:03 +0100 |

<> Just look at the instructions that you have given to Stata: You want the -rownames- to be equal to your "varlist" -local- so that is what you get. Stata repeats the second entry in the -local- as often as it needs to to fill the matrix rows. Your problem might be easily solved via -statsby-, by the way... ******* local varlist "strokeriskNULL strokeriskP55" matrix out = J(20,3,-99) matrix colnames out = risk sex age matrix rownames out = `varlist' mat li out ******* out[20,3] risk sex age strokerisk~L -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 strokeris~55 -99 -99 -99 HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Victor Mauricio Herrera Sent: Samstag, 12. Dezember 2009 08:08 To: statalist Subject: st: matrix out Hello, I'm trying to obtain a matrix using the following code: ********************************************* local varlist "strokeriskNULL strokeriskP55" matrix out = J(20,3,-99) matrix colnames out = risk sex age matrix rownames out = `varlist' local irow = 0 foreach var in `varlist' { foreach i in 2 3 4 5 6 { foreach s in 0 1 { local ++irow qui mim, storebv: svy: regress `var' if sex==`s' & ageg==`i' matrix A=e(b) matrix out[`irow',1]=A[1,1] matrix out[`irow',2]=`s' matrix out[`irow',3]=`i' } } } matrix list out ******************* I expect to get ten lines starting with "strokeriskNULL" and ten starting with "strokeriskP55". However I get only the first line starting with "strokeriskNULL" and the remaining 19 starting with "strokeriskP55". Could anybody point me to what's wrong with these instructions? Very thankful, Mauricio Herrera. * * 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: matrix out***From:*Victor Mauricio Herrera <vherrera@wisc.edu>

- Prev by Date:
**RE: st: RE: Accessing random coefficients in xtmixed** - Next by Date:
**Re: st: RE: matrix out** - Previous by thread:
**st: matrix out** - Next by thread:
**Re: st: RE: matrix out** - Index(es):

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