Statalist


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

Re: st: removing space from $_DATE


From   "Raphael Fraser" <raphael.fraser@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: removing space from $_DATE
Date   Sat, 21 Jun 2008 22:03:26 -0500

I was really hoping there were different date format macros for the
"current date" that I did not know exist. But the suggestions provided
are helpful.

Thanks

On Fri, Jun 20, 2008 at 12:07 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> Some small confusion here. The global macro in question is called S_DATE
> and thus is referenced by $S_DATE: in fact it is usually better quoted
> as "$S_DATE" . It is an old-style equivalent of c(current_date).
>
> The strict answer to Raphael's question is that you can re-define this
> macro to be  without spaces, but it is better to display a copy that
> does not contain the spaces.
>
> As Svend's suggestion implies, this can be done via
>
> subinstr("$S_DATE", " ", "", .)
>
> Nick
> n.j.cox@durham.ac.uk
>
> Svend Juul
>
> Raphael wrote:
>
> The macro $_DATE displays current as 20 Jun 2008. I am looking for a
> simply way to remove the spaces.
> That is, 20Jun2008.
>
> =====================================================================
>
> I did not succeed with $_DATE, but with c(current_date) it is:
>
>    . local z = subinstr(c(current_date) , " " , "" , .)
>    . display "`z'"
>    20Jun2008
>
>
> *
> *   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