Hi,
I have a panel data set. I want to identify the second occurence of "1" in VariableA under the following the condition that there can only be missing between the first value of "1" and the next value of "1" (the value I want to identify). If there is a value of "0" after the first "1", we need to start over.
I have marked the three "1"s that I want to identify in bold in my dataex example below.
Thank you in advance för your help!
Best, Jesper.
I have a panel data set. I want to identify the second occurence of "1" in VariableA under the following the condition that there can only be missing between the first value of "1" and the next value of "1" (the value I want to identify). If there is a value of "0" after the first "1", we need to start over.
I have marked the three "1"s that I want to identify in bold in my dataex example below.
Thank you in advance för your help!
Best, Jesper.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str12 ID float VariableA "Name" . "Name" . "Name" . "Name" . "Name" 0 "Name" . "Name" . "Name" 1 "Name" . "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 1 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 1 "Name" 0 "Name" 1 "Name" 0 "Name" 0 "Name" 1 "Name" . "Name" . "Name" 1 "Name" 0 "Name" 0 "Name" 0 "Name" 0 "Name" 1 "Name" . "Name" . "Name" 1 "Name" . "Name" 0 "Name" . "Name" 1 "Name" . "Name" . "Name" 0 "Name" . "Name" 1 "Name" 1 "Name" . "Name" . "Name" 0 end
Comment