Turns out anything you can
display -- or
di -- on the screen, you can also send to a macro to use later. How useful is that? Well, sometimes you need to say the same thing in different ways. The macro may be set to capture either the form or the substance, depending on which one you need.
I don't usually use macros that way (OK, I wasn't even aware of the possibility until today) but today that need arose, so here's what I learned.
One example of the difference between a thing's looks and substance would be this:
What you see on the screen -- today that would be the string "12 Dec 2008" -- is different from what's behind it -- the value 17878, i.e., the number of days since January 1, 1960.
So you could simply do
local mydate c(current_date)
This looks useful, and maybe it is. The local macro `mydate' above has stored the look of c(current_date), but it knows nothing about its content. You could change that if you defined that macro like this:
So `mydate' is now a number, not a string. Specifically, it's an actual date -- from which you can derive things like
dow(`mydate') or what have you.
But a look of this content, as opposed to the content itself, might be exactly what you want. For example, you may want the YYYYMMDD equivalent of today's date. Easy:
local mydate: di %tdCYND date(c(current_date),"DMY")
So much about that. It's Friday, can't work too hard.