format %d varname
On 7/21/08, Diego Bellavia MD <[email protected]> wrote:
> Dear Statalisters,
>
>
>
> Here it is my (hopefully simple) problem in STATA 10, Windows environment:
>
> I have a variable reporting dates of an intervention (date_baseline)
>
> Then I would like to create a second variable simply going
>
> 100 days forward date_baseline (let us call it date_followup).
>
>
>
> I tried with
>
>
>
> Gen date_followup = date_baseline + 100
>
>
>
> But unfortunately it creates a new variable reporting date
>
> (well I hope at least) not in MDY format but some thing like
>
>
>
> 1. | 17103 |
>
> 2. | 17113 |
>
> 3. | 16518 |
>
> 4. | 17106 |
>
> 5. | 16697 |
>
>
>
> Etc..
>
>
>
> The I tried to convert these numbers in dates using
>
>
>
> tostring date_followup , replace format(%20.0f)
>
>
>
> replace date_followup= date(followup , "MDY")
>
>
>
> But it creates only missing values.
>
>
>
> How can I fix the problem ?
>
>
>
> Thank you in advance,
>
>
>
> Diego
>
>
*
* 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/