Statalist


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

st: RE: Aggregate date to calculate n months


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Aggregate date to calculate n months
Date   Mon, 4 Aug 2008 16:33:15 +0100

My first tip is that you show us your code. We can't comment on
"problems" that aren't explained. 

My second tip is to look at the help, in this case for date functions. 

gen start = mdy(startm, startd, starty) may be a good start. 

Nick
n.j.cox@durham.ac.uk 

Ziad El-Khatib

I entered dates of patients starting on treatment and date of their
interview under different variables:

startd (for day)
startm (for month)
starty (for year)

surveyd (for day)
surveym (month)
surveyy (year)

Now i want to calculate number of months patients have been on
treatment.
I am finding problems in creating
start=startd+startm+starty
survey=surveyd+surveym+surveyy

period=survey-start

Any tips?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index