*! version 0.31

Title

filaby -- marks for each value of first variable first and last
value for second variable within a frame of maxdist.

Syntax

filaby
varlist(min=2
max=2
numeric)
[,
options]

Required
maxdist(#) Integer as max distance

Optional
stub(string) String prefix to the tow generated variables

Description

First and last value of variable 2 within a maxdist for each value
of variable 1 is marked in variables stub_first and stub_last
(zero one variables).

Examples

Generate example data:

clear

set obs 4

set seed 123

gen id = _n * 100

strofnum id

generate exp = runiformint(1,10)

expand exp

drop exp

generate time = runiformint(1,6)

bysort id: replace time = sum(time)

list, noobs sepby(id)

Using filaby to create time blocks of max length 5 within each id:

filaby id time, maxdist(5) stub(my)

list, noobs sepby(id)

Authors and support

Author:

Niels Henrik Bruun,

Aalborg University Hospital

Support:

nbru@rn.dk