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

st: Executing mata drop within a do file after an if condition


From   Thomas Jacobs <thomasjacobs@gmail.com>
To   StataList <statalist@hsphsun2.harvard.edu>
Subject   st: Executing mata drop within a do file after an if condition
Date   Sun, 30 May 2010 19:18:27 -0500

I am trying to drop a mata matrix within a do file while within the
mata environment but have been unable to get it to work.

Thus, I have a do file that begins in stata and at a point early on I have

mata:

then I attempt to execute the following:

mMemSave = strtoreal(st_global("MemSave"))

if (mMemSave > 0) mata drop FirmRawRet

yet I get:

invalid expression
r(3000);

I have checked that the if logic is correct in the immediate window
and have a similar line in many other locations of the program where
the result of the if condition is something different than mata drop.
I have also confirmed I can execute mata drop FirmRawRet from the
immediate window so I believe it is something related to mixing the if
with the mata drop command.

Can anyone enlighten me on what I am doing wrong here?  Thanks.

Tom

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