Statalist


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

Re: st: mata stata() parameters


From   Phil Schumm <[email protected]>
To   [email protected]
Subject   Re: st: mata stata() parameters
Date   Wed, 22 Aug 2007 14:40:30 -0500

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/




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