Hi everyone,
I have problems with my time use data. I have one time diary for each individual in a given family and each variable is in string values. I need to compute the total number of minutes spent on a given activity by each individual in the data set, therefore I entered on the STATA:
egen activity021=total(time) if mainactivity==021, by (family order)
where "time" is the number of minutes you spend on a given activity at a given point in time on the day you are considering; "order" is the number of the individual within a given family!
If I run this code, I get error r109. If I use encode to have numeric values, instead, I do not understand why but I have missing values rather than total minutes spent on a given activity.
I have also tried with real() however it deletes leading zeros that are crucial to distinguish among different activities (e.g. 021 means a given thing, while 21 means stands for a different activity).
Is anyone able to help me?
Thank You all in advance
I have problems with my time use data. I have one time diary for each individual in a given family and each variable is in string values. I need to compute the total number of minutes spent on a given activity by each individual in the data set, therefore I entered on the STATA:
egen activity021=total(time) if mainactivity==021, by (family order)
where "time" is the number of minutes you spend on a given activity at a given point in time on the day you are considering; "order" is the number of the individual within a given family!
If I run this code, I get error r109. If I use encode to have numeric values, instead, I do not understand why but I have missing values rather than total minutes spent on a given activity.
I have also tried with real() however it deletes leading zeros that are crucial to distinguish among different activities (e.g. 021 means a given thing, while 21 means stands for a different activity).
Is anyone able to help me?
Thank You all in advance
Comment