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.
Related Posts with Datetime variable
Logit estimation - Margins - not estimableDear forum members, I face the following issue. I am running a logit regression on survey data (ind…
F-test for Fixed Effect With Robust SEHi everyone, A few days ago i made a post and some of my questions answered very well. But there's …
Removing the intermediate 0 from string variableHey everyone, I have a string variable 'p2' that consists of ID codes formatted as follows "BBSC012…
-gsem- with binary variablesI asked for the following multilevel mediation model where my mediator is a binary variable with 0 a…
oaxaca rifDear all, I have a question regarding user written command oaxaca_rif by Firpo, Sergio, Fortin, Nic…
Subscribe to:
Post Comments (Atom)
0 Response to Datetime variable
Post a Comment