Locating the first occurrence of an event [ssa6: STB-22] ----------------------------------------- ^firstocc^ ident_var rank_var ^=^ exp [ ^if^ exp ] [ ^in^ range ] ^,^ { ^gen^erate^(^varname^)^ | ^sav^ing^(^filename^)^ } identifies the first occurrence of an event for each individual in a panel (time series-cross section) data set. Either the ^generate()^ or the ^saving()^ option must be specified. If the ^generate()^ option is specified, a new variable is created that is `1' when ^= exp^ is true for the first time for each individual and `0' otherwise. Specifying the ^saving()^ option is equivalent to specifying the ^generate()^ option, keeping only the observations where ^varname^ is true, dropping ^varname^, and saving the result. Examples -------- . firstocc id time = married==1, gen(firstmar) . firstocc id t_diagn = illness==1, sav(cancer) Author ------ Dr. Philippe Bocquier, CERPOD bocquier@@orstom.orstom.fr Also see -------- Manual: [5d] survival STB: ssa6 (STB-22) On-line: ^help^ for ^censor^, ^slice^, and ^tmerge^