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]

st: matrix dissimilarity


From   Alp Eren Yurtseven <[email protected]>
To   [email protected]
Subject   st: matrix dissimilarity
Date   Fri, 07 Jan 2011 13:57:44 +0200

Dear all,

I want to create a matrix for each sector and year, holding the Euclidean distance between all the observations for variables att1 att2 att3 att4. p and sec denote year and sector respectively. I want to do this with a nested loop:

levelsof p,local(y)
levelsof sec,local(s)

foreach p in `y' {
    foreach sec in `s' {
    matrix dissimilarity DE`s'`y'=att1 att2 att3 att4
    }
}

I am not very familiar with loop structures in Stata and not surprisingly I get an invalid syntax error. I'd be very glad if you could give me some hints to solve this problem. Thanks in advance.

Regards

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