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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Creating STATA Date variable


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Creating STATA Date variable
Date   Sun, 25 Sep 2011 23:41:32 +0100

What's the difficulty?

You know you are dealing with dates. You know Stata has help. -help
dates- points to

gen dailydate = mdy(month, 15, year)
format dailydate %d

Nick

On Sun, Sep 25, 2011 at 11:09 PM, Venkiteshwaran, Vinod
<Vinod.Venkiteshwaran@tamucc.edu> wrote:

> I have a stata data set with two columns that correspond to the month (double, %12.0g) and year(float,%9.0g) of my observations.
> To be honest I do not know what the type and format of the variables imply.
> I want to create a new variable,date, that combines these two variables.
> To complicate matters I also need to set the date itself to the 15th of the month for each observation.
> That is in a mm/dd/yyyy format I want all the dates (dd) to be set to the 15th along with the corresponding month and year that are in my dataset.
> Any inputs /suggestions?
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index