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

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Updating the value of a specific cll of a matrix using the value of a variable |

Date |
Tue, 22 Nov 2011 16:08:38 +0000 |

You must subscript -counter- e.g. counter[1]. -display- indulges lack of subscripts and defaults to showing values in observation 1. But -matrix- requires a subscript in this context. Nick On Tue, Nov 22, 2011 at 4:02 PM, Tatiana SOKOLOVA <sokolovat@hec.fr> wrote: > 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. > * * 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/

**References**:**st: Updating the value of a specific cll of a matrix using the value of a variable***From:*"Tatiana SOKOLOVA" <sokolovat@hec.fr>

- Prev by Date:
**st: Updating the value of a specific cll of a matrix using the value of a variable** - Next by Date:
**Re: st: Store results from table command in matrix** - Previous by thread:
**st: Updating the value of a specific cll of a matrix using the value of a variable** - Index(es):