Statalist


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

Re: st: mata stata() parameters


From   "Sergiy Radyakin" <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: mata stata() parameters
Date   Wed, 22 Aug 2007 23:25:56 -0400

Hello Phil,

thank you for this reply. I wonder if there is any way to change this
behaviour of Mata? I would really want to have full control of my
strings as I have in other languages.

Thanks to Phil's suggestion the issue is now resolved.

Best regards,
   Sergiy



On 8/22/07, Phil Schumm <pschumm@uchicago.edu> wrote:
> On Aug 22, 2007, at 2:14 PM, Sergiy Radyakin wrote:
> > stata("local _AAA=month(d(`c(current_date)'))",1,1)
> > mc=strtoreal(st_local("_AAA"))
> >
> > This code produces the result I want, e.g. mc becomes equal to 8.
> > However, after compiling the procedure into an .mo file, I can see
> > that the call is stored as:
> >
> > local _AAA=month(d(22 Aug 2007))
> >
> > note that 22 Aug 2007 is today's date. There seems to be no difference
> > whether I specify no-macro-expansion parameter or not.
> >
> > Where is a mistake?
>
>
> Sorry, I didn't tell you your mistake, though you've pretty much
> figured it out for yourself.  In Mata, macro expansion is performed
> at compile-time, not at run-time.  For more info, see
>
>
> http://www.stata.com/statalist/archive/2005-08/msg00852.html
>
> and
>
> http://www.stata.com/statalist/archive/2007-04/msg00836.html
>
>
> -- Phil
>
> *
> *   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/
>
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index