Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • problems with time diaries - error r109

    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

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    If your variables are strings, then you cannot use them in calculations. You don't give us enough information to help you. You can use egen with group to create numerical ids for each of your strings. Alternatively, if you don't have too many of a category, you can do it manually with generate and if statements or a recode statement.

    Comment


    • #3
      Thank you a lot, in the end I was just forgetting that with string values you need to use "" after ==

      Comment

      Working...
      X