help tocalendar

Syntax

tocalendar , diaryid(string) diaryst(n)

Description

tocalendar -- converts an episode file in long format —where each row represents an episode of activity— into a calendar file in long format,
where each row of data represents a time slot of constant duration.
The new file will have the same number of observations for each diary.
The number of observations in the calendar file produced will depend on the duration of the time interval, which will be determined by the shortest episode in the data,
most likely coinciding with the duration of the time interval in the diary instrument used to collect the data.
For example, in a file where the shortest episode lasts 10 minutes, the calendar file created will have 144 time slots or observations per diary.

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.

Arguments

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.

Outcomes

tslot: variable containing the time slot.

start: variable containing the start time of the time slot, expressed as minute of the day (0-1439).

end: variable containing the end time of the time slot, expressed as minute of the day (1-1440).

Variables that need to exist

The following variables need to exist in the dataset for the program to work.
If you have an episode file these variables should be there although they may have different names, in that case simply rename them.

epnum: variable indicating the episode number within each diary.

time: variable indicating the duration of the episode (in minutes).

Example:

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. episode file defined by the primary activity, secondary activity and location. The diary starts at 4:00 am and the diary identifier is the variable 'id'.

. net get timeuse

. use example_diary, clear

. tocalendar, 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). tocalendar: Stata module to transform episode files into calendar files. 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.