Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: working with dates


From   Diego Bellavia MD <[email protected]>
To   [email protected]
Subject   st: working with dates
Date   Mon, 21 Jul 2008 10:10:09 -0500

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




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