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

st: mata stata() parameters

From   "Sergiy Radyakin" <>
To   "" <>
Subject   st: mata stata() parameters
Date   Wed, 22 Aug 2007 15:14:46 -0400

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)

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:

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