Hello Statalisters,
I am working with Stata 9.2 and I need to get today's day, month and
year. Since these functions were introduced in Stata 10 and not
available in Stata 9.2 I am calling Stata from inside mata to retrieve
the components of today's date:
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? (I want the compiled code to access current date,
not the date when it was compiled).
Thank you,
Sergiy Radyakin
*
* 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/