Statalist


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

RE: st: removing space from $_DATE


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: removing space from $_DATE
Date   Fri, 20 Jun 2008 18:07:23 +0100

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 
[email protected] 

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/



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