Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: survival data analysis- recode survival time variable


From   "Villa Lora, Juan Miguel" <[email protected]>
To   <[email protected]>
Subject   st: RE: survival data analysis- recode survival time variable
Date   Mon, 24 Aug 2009 17:14:34 -0400

Johanes,
I can see you are handling with a string variable. You might divide this
variable into two differents variables containing years and months and
multiply 12 times years thereafter:

gen year = substr(varname, 1, 2)
gen month = substr(varname, 3, 2)

destring year month, replace

gen time_in_month = (year*12) + month

See help subtr for more details.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Johannes
Schoder
Sent: Lunes, 24 de Agosto de 2009 04:57 p.m.
To: [email protected]
Subject: st: survival data analysis- recode survival time variable

Hi,

I am working with survival data and have the problem that my variable
survival time is in the following format:
yymm, where y represents years and m months. Instead of the yymm format
I just want to have it in months since otherwise I always have the jump
from 11 months (0011) to 1 year (0100).

Thank you very much for your help!
Johannes
*
*   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/

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