Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: RE: Keeping the upper triangle of a matrix.


From   Philipp Krueger <[email protected]>
To   [email protected]
Subject   Re: st: RE: Keeping the upper triangle of a matrix.
Date   Thu, 20 Jan 2011 19:58:36 +0100

That did the trick. Thank you so much Nick.
Philipp
Am 20.01.2011 19:26, schrieb Nick Cox:
Sounds like

keep if var1<= var2

Nick
[email protected]

Philipp Krueger

I am a bit stuck. I have the following dataset

var1; var2; var3
1; 1; aaa
1; 2; def
1; 3; ghi

2; 1; def
2; 2; aaa
2; 3; klm

3; 1; ghi
3; 2; klm
3; 3; aaa

Essentially, the three row vectors of a 3x3  matrix are stacked
underneath each other in a dataset. Since the matrix is symmetric, I
would like to keep only the observations corresponding to the lower
triangle of the matrix (including the diagonal), i.e. observations
1,2,3,5,6,9 in the dataset. All other observations (i.e. 4 and 8 should
be dropped. I have tried hard but could not find a solution.

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index