Statalist


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

Re: st: RE: analogues of macros in Mata?


From   "Stas Kolenikov" <[email protected]>
To   [email protected]
Subject   Re: st: RE: analogues of macros in Mata?
Date   Mon, 29 Sep 2008 16:56:12 -0500

Well I read it, and Mr President Bill G addresses some of those
questions (like how to organize cycles with variables in Mata rather
than with macros in Stata, and how to deal with string literals in
Mata). But it looks that in my particular case, where I have
repetitive execution time substitutions of the file name, I would
really need to go back to Stata to achieve exactly what I want (to
have a .mmat name of my choosing). At any rate, the occasion I needed
that for was in simulations, so I am switching between Stata and Mata
a few times, and won't be bothered switching to Stata in the end to
save my simulation results:

args simulation parameters
local thenameIwant simul-`simulation'-`parameters'
mata:
// simulations
end
mata : mata matsave `thenameIwant' All Those Matrices
exit

On 9/17/08, Nick Cox <[email protected]> wrote:
> Bill Gould has a Mata matters column out real soon now in Stata Journal
>  8(3) 2008 that should help here.
>
>  Nick
>  [email protected]
>
>  -----Original Message-----
>  From: [email protected]
>  [mailto:[email protected]] On Behalf Of Stas
>  Kolenikov
>  Sent: 17 September 2008 15:22
>  To: [email protected]
>  Subject: st: analogues of macros in Mata?
>
>  Suppose I form say a filename using some string operations, something
>  like
>
>  myfilename = prefix + "-" + suffix
>
>  and then want to save something along the lines of
>
>  mata matsave {myfilename} Matrix1 Matrix2 Matrix3
>
>  Is there any way to have Mata go into the contents of myfilename
>  object there, rather than create the file "myfilename.mmat" in the
>  current directory? Or may be explicit version
>
>  mata matsave prefix+"-"+suffix Matrix1 Matrix2 Matrix3
>


-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index