Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Years to dates


From   "Terra Curtis" <[email protected]>
To   <[email protected]>
Subject   RE: st: Years to dates
Date   Tue, 20 Sep 2005 14:51:59 -0400

Thanks, Sebastian.  I got it to work using your method and then formating
the new variable:

format variable1 %dN/D/Y 
format variable2 %dN/D/Y

so that it would make sense to the human reader. 

Terra


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Seb Buechte
Sent: Tuesday, September 20, 2005 2:26 PM
To: [email protected]
Subject: Re: st: Years to dates

Terra Curtis asked for an easy way to create a certain date within a known
year:

I think of one way, eventhough I am not very familiar with time-series data,
I guess it should still work:

(let the variable "year" be the container of your years than it should work
the following way:)

gen variable1=mdy(1,1,year)
gen variable2=mdy(12,31,year)

kind regards
sebastian


On 9/20/05, Terra Curtis <[email protected]> wrote:
> Dear Statalist,
> 
> I have a two variables of type %ty (for example, 1998).  I wish to 
> change
> variable1 to 01/01/1998 and variable2 to 12/31/1998.  Is there an easy 
> way of doing this?
> 
> Thanks,
> Terra
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


--
- Seb F Buechte
-
- Stay tuned!

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index