Statalist


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

Re: st: replace


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: replace
Date   Fri, 04 Sep 2009 11:37:27 +0200

. by ID (Year), sort: replace status = status[_N]

Am Freitag, den 04.09.2009, 11:34 +0200 schrieb [email protected]:
> Dear statalist 
> 
> I have a data set which I would like to analyse with survival analysis and 
> panel analysis.
> 
> Excerpt from my data set:
> ID      Year    status 
> 1       2000    0                                
> 1       2001    0 
> 1       2002    0 
> 1       2003    1
> 
> 2       2002    0
> 2       2003    0
> 2       2004    0
> 2       2005    0
> 
> 3       2001    0
> 3       2002    0
> 3       2003    2 
> 
> 4       2002    0
> 4       2003    3
>  
> 
> For the panel analysis I would like to change the variable "status" (with 
> the information on 4 different reasons (so status could be 1,2,3,3) of 
> death and 0=pending) so that I have the "reason of death" in all years and 
> not in the year of death.
> 
> Like this:
> ID      Year    status
> 1       2000    1
> 1       2001    1
> 1       2002    1
> 1       2003    1
> 
> 2       2002    0
> 2       2003    0
> 2       2004    0
> 2       2005    0
> 
> 3       2001    2
> 3       2002    2
> 3       2003    2 
> 
> 4       2002    3
> 4       2003    3
> 
> Could anybody help my how to replace the "0" with "1" "2" "3" "4" if the 
> person is death?
> 
> Thank you for your help.
> 
> Best Frauke
> 
> ___________________________________
> 
> Frauke Rüther, Dipl.-Kffr., M.A.
> Research Associate
> University of St.Gallen
> Institute of Technology Management
> Dufourstrasse 40a
> CH - 9000 St. Gallen
> 
> Phone   +41 (0)71 224 7225
> Fax        +41 (0)71 224 7301
> Email    [email protected]
> Web      www.item.unisg.ch
> 
> *
> *   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