help timeusex

Syntax

timeusex var, diaryid(string) diaryst(string)

Description

timeusex -- transforms an episode file in long format —where each row represents an episode of activity— into a diary-level file that summarizes the time use information for the selected activity.
The new file will contain variables with the following information: total time spent on the activity, number of times the diarist engages in the activity on that day, and timing and duration for the different episodes of activity.
If instead of having so much information about a single activity, you wish to know how much time is spent across several activities, consider using the program timeuse.

For the program to produce the desired results, the diary should cover an entire 24-hour period, and the episodes of activity should be non-overlapping and contain no gaps between them.
In other words, all diaries should start at minute 0, end at minute 1440, and the end of one episode should coincide exactly with the start of the next episode.
It may be a good idea to run epichecks before using this program, because if there were any errors in 'start' and/or 'end,' the program may not produce the desired results.

Outcomes

The program creates a diary level file with the following variables:

total: total time in the activity

episodes: number of episodes devoted to the activity, iow, number of times that the diarists engages in the activity.

start1 to startN: start time (minute of diary) of the each episode of activity

end1 to endN: end time (minute of diary) of each episode of the activity

duration1 to durationN: duration (in minutes) of each episode of activity

start_last: start time (minute of diary) of the last episode of the activity for that diary.

end_last: end time (minute of diary) of the last episode of the activity for that diary.

duration_last: end time (minute of diary) of the last episode of the activity for that diary.

Arguments

var: dummy variable taking the value 1 whenever the episode of activity
is equal to the activity of interest, and any other value otherwise.

diaryid(string): the names of the variable or variables that when considered jointly uniquely identify the diary.

diaryst(n): a number that indicates the start time of the diary in a 24 hour system clock, with "0" representing midnight, "4" is 4am, and "18" would be 6pm.

Variables that need to exist

The following variables do need to exist for the program to work since the ado file will call them at some point.
These variables should already exist in the data, simply rename them as 'start' and 'end'.

start: start time of the episode expressed as minute of day.
"start" can take values from 0 to 1439. The first episode of the diary should start at minute 0.

end: end time of the episode expressed as minute of day. "end" can take values from 1 to 1440. The last episode of the diary should end at minute 1440.

Examples

The following lines of code load the dataset "diary.dta" and convert it into a diary level file -where each row of data represents a day- with detailed information for several activities.
The first example explores eating, and the second explores solitary TV use (watching TV alone). The diary starts at 4:00 am and the diary identifier is the variable 'id'.

Example 1: exploring eating

. net get timeuse

. use diary, clear

. gen eating=0

. replace eating=1 if primary==2|secondary==2

. timeusex eating, diaryid(personid diaryid) diaryst(4)

Example 2: watching TV alone

. net get timeuse

. use diary, clear

. gen tvalone=0

. replace tvalone=1 if primary==14 & ww_alone==1

. timeusex tvalone, diaryid(personid diaryid) diaryst(4)

Example 3: exercising outdoors with others

. net get timeuse

. use diary, clear

. gen exercise=0

. replace exercise=1 if primary==17 & inout==2 & ww_alone==0

. timeusex exercise, diaryid(personid diaryid) diaryst(4)

Author:

Juana Lamote de Grignon Pérez, Centre for Time Use Research (UCL), juana.lamote@gmail.com

Thanks for citing this software as follows:

Lamote de Grignon, J. (2024). timeuse: Stata package to facilitate the manipulation of diary-based time-use data. Available from: https://ideas.repec.org/c/boc/bocode/s459346.html.

Acknowledgments

I am grateful to Elena Mylona and Margarita Vega Rapún for their feedback during the development of the program.