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, statalist.org is already up and running.


[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" <sokolovat@hec.fr>
To   <statalist@hsphsun2.harvard.edu>
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/


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