Good morning!
I'm working with ISTAT dataset "use of time". I just want to run some basic analysis but I'm not an expert STATA user so I'm quite lost... I want to thank in advance those who can help me.
The dataset has one record for each episode (codified as a number) reported by the respondent in the daily diary, as in the following table:
n_family n_component activity start_hour start_minute finish_hour min_finish
1 1 52 7 10 9 00
1 1 22 17 50 18 00
1 2 11 20 00 21 00
1 3 27 5 25 6 25
Row 1 means that the component number 1 of the family n1 did activity n.52 from 7:10 to 9:00 in the morning. The same person spent his time doing the activity n22 from 17:50 to 18:00 (row n2).
What I would like to do is to have, for each individual, a variable that indicates how much time he/she spend doing each activity (but I still don't have a variable that uniquely identifies the observations).
I created two new variables indicating the starting and finishing time. For example, for row1 I created a variable "start" with content "7:10" and a variable "finish" with content "9:00" in this way:

Code:
gen start = string(start_hour) + ":" + string(start_minute)
gen finish = string(finish_hour) + ":" + string(finish_minute)
And the numeric version of the variable:

Code:
encode start, gen (start_num)
encode finish, gen (finish_num)
How can I create a new variable that indicates the duration of the episode?
Thank you!
Giulia