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: Converting year variable into a date variable


From   Erik Aadland <[email protected]>
To   <[email protected]>
Subject   RE: st: Converting year variable into a date variable
Date   Thu, 22 Nov 2012 11:24:13 +0000

Thank you, Nick!
Kind regards,
Erik.

----------------------------------------
> Date: Thu, 22 Nov 2012 11:09:36 +0000
> Subject: Re: st: Converting year variable into a date variable
> From: [email protected]
> To: [email protected]
>
> . gen year2 = mdy(12, 31, year)
>
> On Thu, Nov 22, 2012 at 10:47 AM, Erik Aadland <[email protected]> wrote:
>
> > I have a panel dataset in which I have the variable -year- that contains values of e.g. 1998, 1999, etc.
> > I want to make a new -year2- variable and convert this one into a date variable.
> > In particular, I want to convert each -year2- value into the last date for that year so that e.g. 1998 == 31.12.1998, 1999 == 31.12.1999, etc.
> > How can this be accomplished?
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/ 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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