Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: Recoding with values of the next spell


From   Kai Huang <demonsecret@hotmail.com.hk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Recoding with values of the next spell
Date   Wed, 29 May 2013 20:18:58 +0000

Many thanks. How about if I want to count the total number of persons instead of spells? In this case, the total number of persons is 3 as deduced from the id.

----------------------------------------
> Subject: Re: st: Recoding with values of the next spell
> From: f.belotti@gmail.com
> Date: Sun, 26 May 2013 22:17:43 +0200
> To: statalist@hsphsun2.harvard.edu
>
> gen Yimp = Y
> sort ID Start
> by ID: replace Yimp = Yimp[_n+1] if Yimp==. & Yimp[_n+1]!=.
>
> Federico
>
> Il giorno 26/mag/2013, alle ore 21:37, Kai Huang <demonsecret@hotmail.com.hk> ha scritto:
>
>> Dear all,
>>
>> I have a spell dataset with some missing values of variables as follows:
>>
>> ID Start End Y
>> 766 1987 1988 1
>> 766 1988 1990 .
>> 766 1990 1994 0
>> 768 1988 1991 1
>> 768 1991 1993 0
>> 769 1987 1994 .
>> 769 1994 1995 1
>>
>> If the missing values can be recoded with values of those of the next chronological spell, are there any commands in STATA which can support doing such task? Thank you very much in advance.
>> Best regards,
>> Kai Huang
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index