Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, is already up and running.

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

st: doubt on Mata using multiple loops

From   Gioia de Melo <>
Subject   st: doubt on Mata using multiple loops
Date   Sat, 13 Mar 2010 09:44:09 -0300


I have problems linking two matrices with for and if.
Matrix X is of n*5, in the first column it identifies firms, columns 2:5
identify firms that are connected to firm in column 1. I need to create a
symmetric matrix A nxn that has 1 in cells between two firms that are

I run this program but it does not alter A although it does not point any



X = st_data(.,.)

for (i=2;i<=cols(X);i++) {
for (j=1;j<=rows(X);j++){
for (i1=1;i1<=cols(A);i1++) {
for (j1=1;j1<=rows(A);j1++){
if (j1==j & i1== X[j,i]){

Thank you for your help.


*   For searches and help try:

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