Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: format of S_DATE global

From   Pablo Bonilla <>
To   statalist <>
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.



Pablo Bonilla
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index