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: generate a date (plus 40 days from a start date)


From   Ras Dondo <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: generate a date (plus 40 days from a start date)
Date   Thu, 15 Mar 2012 16:10:30 -0700 (PDT)

Hi Agnieszka,

You should have stated the version of Stata you are using as this guides whoever is responding to your question.

Anyway, back to your question

1. Make sure you have your date formatted as Stata date if it is not already done. For Stata 9 you can use this command - format date %d - 

2. Now use this command to get what you want - generate newdate=date+40 - .This will generate the new date but if you list you will only see numbers and not dates. To get the results in date format use this command - format date %d - 


All the command are combined for you below:
format date %d 
generate newdate=date+40 

format newdate %d  


All the best

Ras



----- Original Message -----
From: Agnieszka Trzeciakiewicz <[email protected]>
To: [email protected]
Cc: 
Sent: Tuesday, March 13, 2012 3:40 PM
Subject: st: generate a date (plus 40 days from a start date) 

Hi,
I am trying to write a formula, that will generate an end date variable
which will be distance from a start date for 40 days.
For instance start date is 1/09/2000 end date should be 10/10/2000
(1/09/2000+40 days)
Thanks,
Agnieszka

*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/statalist/faqhttp://www.ats.ucla.edu/stat/stata/


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