Code:
input person var1 1 1 1 2 1 . 1 3 1 1 1 4 2 2 2 2 2 . 2 . 2 3 2 3 3 3 3 4 3 . 3 . 3 . 3 . end
if var1 is missing, fill with previous value
if var1 at time t is 3, all future var1 values are set to 3 unless there is a 4, which stays a 4
if var1 is missing after a 4, remove that row
DESIRED OUTPUT:
Code:
input person var1 id var1 1 1 1 2 1 2 1 3 1 3 1 4 2 2 2 2 2 2 2 2 2 3 2 3 3 3 3 4 end
0 Response to Fill column based on simple rules
Post a Comment