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: Generate Start and End Dates for SMCL Log Reports


From   Kristina Beatrice Benavidez <[email protected]>
To   [email protected]
Subject   st: Generate Start and End Dates for SMCL Log Reports
Date   Thu, 20 Sep 2012 15:23:20 +0100

Hi StatListers,

I have numerous analysis SMCL log files to create.

One of my datasets runs from 16/07/2012 until 20/08/2012.

These date observations are in the date variable and is in "DMY" %td format.

In the log file, I need to write the sentence: "This analysis runs from
16/07/2012 to 20/08/2012."

I would like to do this without having to manually look at the dataset to
find the startdate (16/07/2012) and enddate (20/08/2012) because I'll have
to do this across many datasets.

How would I do this?

I tried
. egen startdate = min(date)
. egen maxdate = max(date)
. format startdate & enddate %td

I tried to make the first observation of the startdate variable (there is
only one startdate so the observations across the startdate variables are
all the same) so that I can then put this in the SMCL log file:

. scalar startdatescal = startdate[1]

However, the result gives me 19190 which is the stata date number and does
not appear as the %td date format.

How do I perhaps transform the startdate and enddate variable formats from
elapsed date to non-elapsed date whilst still keeping the date format
appearance?

I cannot find a way to get to the sentence I need without having to look up
the startdate and enddate everytime.

Any help would be appreciated.

Kind regards,


Beatrice Benavidez
*
*   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