[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: AW: RE: AW: How to form a vector for each line |

Date |
Thu, 15 Oct 2009 19:03:20 +0200 |

<> That was a little subjective, admittedly, as I have never used a vector outside -mata-. This fact need not stand in the way of Steven`s happiness, though... HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox Gesendet: Donnerstag, 15. Oktober 2009 18:58 An: statalist@hsphsun2.harvard.edu Betreff: st: RE: AW: How to form a vector for each line I agree with the advice to use Mata. Some readers may find Martin's opening sentence a little puzzling, however. In Stata, as compared with Mata, there is no difficulty in setting up row or column vectors, which are just matrices with one row or column. In this sense, Stata has had the idea of vector for several versions now. Nick n.j.cox@durham.ac.uk Martin Weiss Vectors are not really a well-known concept in Stata, although naturally you can have them in -mata-. I have never missed them, though, as you can do what you want to do without them most of the time. What is it you want to achieve? *** clear* input byte( a b c) 3 4 3 2 3 4 2 5 6 2 0 4 end compress list, noobs capt which tomata if _rc ssc inst tomata tomata a b c mata A=a,b,c A[2,.]*A[2,.]' A[2,.]'*A[2,.] end Steven Ho Suppose I have a data like this: a b c 3 4 3 2 3 4 2 5 6 2 0 4 What I want is something like this, of course the following command doesn't work gen arrayZ[_n]=( a[_n], b[_n], c[_n]) so that arrayZ[3] for example would be (2,5,6) ie. when I invoke Z[t] it will give me a VECTOR of t-th row I need this because I will do a whole bunch of operations to Z[t]Z[t]' How to achieve this? * * 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: How to form a vector for each line***From:*Steven Ho <steven.ho@duke.edu>

**st: AW: How to form a vector for each line***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: RE: AW: How to form a vector for each line***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: AW: How to form a vector for each line** - Next by Date:
**Re: st: standard errors using MARGINS** - Previous by thread:
**st: RE: AW: How to form a vector for each line** - Next by thread:
**Re: st: AW: creating two groups with identical distribution of one variable** - Index(es):

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