Statalist The Stata Listserver


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

st: RE: RE: RE: If in Mata


From   Jesper Kj�r Hansen <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: If in Mata
Date   Wed, 12 Apr 2006 10:35:58 +0200

Sorry about that, Daniel. 

I had not encountered this problem before...

/Jesper

> 
> I am not using it interactively. But it doesn't matter whether I go
> 
> mata
> if (1==1) "Hello world"
> end
> 
> Or
> 
> mata: if (1==1) "Hello world"
> 
> Both don't work and if I understand the documentation correctly, they
> should.
> 
> I am using the if-function as part of a larger script that uses some
> matrices to store and manipulate results from a couple of regression
> models (actually, a lot, so no, I can't use the non-mata 
> matrix commands
> for several reasons). I have to use the mata-if function, because I
> check a feature of a mata-matrix and then ask it to execute a
> mata-command on that matrix - but I reduced the if-command to 
> the simple
> version that I have shown in the email because it is fairly fail-proof
> in terms of other errors in the coding. 
> 
> The solution you suggested (mata: if (1==1) {} "Hello world") doesn't
> really work. It does not really run the if check, so if you use 
> mata: if (1==0) {} "Hello world"
> You still get a "Hello World" as output (and it shouldn't, 
> because 1 is
> obviously not 0).
> 
>

*
*   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