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 on April 23, and its replacement, is already up and running.

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

st: mata for-if-else

From   "Abhimanyu Arora" <>
To   <>
Subject   st: mata for-if-else
Date   Wed, 14 Apr 2010 11:54:49 +0200

Dear statalist, 
I have simplified my problem to a large extent, but essentially has to do
with using for-if-else commands in mata. I would like to create a matrix 'a'
whose values depend on an existing matrix 'b' (both are 1000X1 vectors to be
precise). I need to tell mata the dimension of a first. But all I get after
executing the commands below is the original vector 'a'. What could be the
possible error? I have tried adding and removing braces but it is not

for(i=1,i<1001,i++) {
if (b[i]==1){
else {a[i]=3

Thanks a lot

*   For searches and help try:

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