Statalist


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

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


From   "Villa Lora, Juan Miguel" <[email protected]>
To   <[email protected]>
Subject   FW: st: RE: survival data analysis- recode survival time variable
Date   Tue, 25 Aug 2009 09:22:12 -0400

 

-----Original Message-----
From: Johannes Schoder [mailto:[email protected]] 
Sent: Lunes, 24 de Agosto de 2009 05:54 p.m.
To: Villa Lora, Juan Miguel
Subject: Re: st: RE: survival data analysis- recode survival time
variable

Hi Juan,
Thank you very much for your help thats a great idea!!
However, when I run the command Stata always tells "type mismatch".
what I did:

gen year=substr(SURV, 1, 2)
**I guess this command is generating the year variable by just taking
the first to digits. And I guess here lies the problem because if the
survival time is e.g 1 year my spread sheet looks like this: 100 and not
0100. But I am totally not sure if this is the problem.
If you may allow I attached a subsample of the dataset.
Thank you so much for your help!!

Best,
Johannes




Villa Lora, Juan Miguel schrieb:
> 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/
>   

Attachment: SURV_DATA.dta
Description: SURV_DATA.dta




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