Hello,
I converted an Excel File into a Stata File. It concerns data from a website, in which participants monitored their health by filling in a questionnaire. In Stata, every participant has #amount of rows, dependent of how many times they filled in the health-questionnaire (e.g. a participant that filled in the questionnaire 6 times, has 6 rows in stata). I would like to calculate the difference in days between the first and the last time each participant filled in this questionnaire (for more than 3000 participants).
I use a datetime variable that looks like this: 5-09-18 10:00
I have two questions:
- What command should I use to convert this variable from string to date/time? I tried to use clock( var_name ,"DMYhm") but this didn't work.
- What command should I use to calculate the difference between the first and last row? Note that the amount of rows is different for each participant.
Thanks in advance for your reply.
Sophie.
0 Response to Datetime variable
Post a Comment