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: Updating the value of a specific cll of a matrix using the value of a variable
From 
 
"Tatiana SOKOLOVA" <[email protected]> 
To 
 
<[email protected]> 
Subject 
 
st: Updating the value of a specific cll of a matrix using the value of a variable 
Date 
 
Tue, 22 Nov 2011 17:02:06 +0100 
I have created a double loop to generate counter variable values that will then be entered into an OUTPUT matrix. Everything except for 1 line seems to be working. The line is here:
  matrix OUTPUT[`i', `j'] = counter
* where i and j are the row and column indexes for the two loops and INPUT is defined as a 14x122 matrix
*STATA writes: counter not found. But then I write:
display counter
* STATA shows the value of counter, say 4:
4
*yet, if I use the same code and instead of the variable counter use a number, it works (the matrix OUTPUT is updated):
  matrix OUTPUT[`i', `j'] = 4
*I.e. the program does not recognize the variable counter when I want to udpate the matrix using its values. I have tried to use `counter' instead of counter but an error is reported again.
Regards,
Tatiana
*
*   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/