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
Bound test - Collinearity IssueHello, I am trying to run the bounds test for cointegration. I have performed Code: varsoc depvar…
Exporting marginal effects and its confidence intervalsHello, I am estimating average marginal effects using `margins` after `probit` and `ivprobit`. I ne…
Gini decomposition by income sourceHi all, I would like to decompose the Gini coefficient by income source, applying the Lerman-Yitzhak…
JACCARD similarity measureHi I am working on similarity measure on the different assets classification. I have close to 12 ass…
Replacing missing values in groupsHi everyone, I am working with a dataset with fiscal years, CIK codes and employee ids. For the fis…
Subscribe to:
Post Comments (Atom)
0 Response to Datetime variable
Post a Comment