Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: format of S_DATE global


From   Pablo Bonilla <[email protected]>
To   statalist <[email protected]>
Subject   st: format of S_DATE global
Date   Thu, 16 Aug 2012 11:14:01 -0400

Dear Stata list,
In the middle of a program I need to save in a csv file the exact date
and time in which the program was used by somebody in my office.  I
use the following script in the middle of the program:

tempname hh
file open `hh' using "C:\data\time.csv ", write text append
file write `hh'  "$S_DATE, $S_TIME, `pais', `year', `survey' " _n
file close `hh'

When I open the CSV file in Excel it understands correctly those dates
which its days are greater than 10 (e.g., 16 Aug 2012, 15 Apr 2012, 23
Jul 2012) but those which its days are smaller than 10 (e.g., 6 Aug
2012, 5 Apr 2012, 3 Jul 2012) Excel cannot read them as dates. I would
like to know if I kind change the format of the S_DATE global, so it
will display 08/16/2012 instead of 16 Aug 2012, So Excel can
understand. Any other suggestion is more than welcome.

Thanks


-- 
----

Pablo Bonilla
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index