add_duration function

Add duration variables to panel data