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]

Re: st: Creating STATA Date variable


From   Nick Cox <[email protected]>
To   [email protected]
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
<[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index