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: Keeping the upper triangle of a matrix.


From   Mitch Abdon <[email protected]>
To   [email protected]
Subject   Re: st: Keeping the upper triangle of a matrix.
Date   Fri, 21 Jan 2011 09:19:48 +0800

Have you tried - drop if var1 > var2 -?

On Fri, Jan 21, 2011 at 2:22 AM, Philipp Krueger
<[email protected]> wrote:
> Dear statlisters,
> 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.
> I would greatly appreciate your help.
> Many thanks in advance.
> Philipp
> *
> *   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/
>



-- 
Best,
Mitch


Arnelyn Abdon
+639178034402
http://statadaily.wordpress.com
http://www.facebook.com/pages/Stata-Daily/116477895082525

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