Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: If in Mata


From   "Daniel Schneider" <[email protected]>
To   <[email protected]>
Subject   st: If in Mata
Date   Tue, 11 Apr 2006 13:54:39 -0700

I am lost, and I do not know anymore what I am doing wrong with this
very simple problem. I have been trying to get a very simple if-clause
to run in Mata, but it hasn't worked at all. I have finally reduced the
if-statement to the most simple form:

mata: if (1==1) results[1,1]


(results[1,1] should just output a number)

What I get is 

unexpected end of line
<istmt> incomplete


If I do

. mata: if (1==1) {results[1,1]}

I get:
invalid expression


I have re-read the helpfile a couple of time, but I cannot figure out
what I am doing wrong. If I go into mata and enter the command by hand,
I get an ">" at the beginning of the line suggesting that Mata waits for
me to tell it that there is nothing else coming, but I have no clue how
to do that.

Can anyone tell me what I am doing wrong?


Daniel

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index