a month ago
I need to achieve the below and would be grateful if some one can give me a hand:
I have to create 1 matrix with all zeros to begin with and then set the first element to 1.
Then I need to start a do loop which should check if there is any element in table 2 which is negative.
(i'm doing a set of transformation between table 1 and 2, which makes one or more elements in table 2 as -ve.)
Now if there is -ve value in any element in table 2, then change the element in table 1 to "0" and move to the second element of table1 by assigning "1" and so on and so forth.
If there is no –ve value in table 2 then no action to be performed on table 1 and the loop should move to the next element.
Attached is the sample data. After the first iteration the output table should look like the one mentioned in the attachment, as we have a –ve element ,i.e. -66.
At the end I should have table 1 filled with all 0’s and 1’s. With my limited IML knowledge, I have set the first element of table 1 to “0”. But struggling to put a do loop around the matrix. Any help will be really appreciated.
N = nrow(V);
Table1 = j(N, N, 0);
IF H[1,1] = 0 THEN table1[1,1]= 1;
ELSE table1[1,1]= 0;