Hi everyone,
I have a dataset with travel modes used in trips by individuals. The number of observations varies beween individuals. Also, not all the travel modes are informed (so i have for every individual some missing values). I need to know the individuals that did not change their travel mode between the different trips.
The variables I use are:
ID: individuals
Ndep: the trip code (starting from 1)
mode: used mode (variable with missing values)
I tried the command:
by ID, sort : gen same= mode[1]==mode[_N]
But STATA do not ignore the missing values. So it considers that for an individual, an observation with a missing value is different than the others, even if the other observations have the same value.
How to tell STATA to ignore the missing values?
Thanks
I have a dataset with travel modes used in trips by individuals. The number of observations varies beween individuals. Also, not all the travel modes are informed (so i have for every individual some missing values). I need to know the individuals that did not change their travel mode between the different trips.
The variables I use are:
ID: individuals
Ndep: the trip code (starting from 1)
mode: used mode (variable with missing values)
I tried the command:
by ID, sort : gen same= mode[1]==mode[_N]
But STATA do not ignore the missing values. So it considers that for an individual, an observation with a missing value is different than the others, even if the other observations have the same value.
How to tell STATA to ignore the missing values?
Thanks

Comment