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
Plotting marginal effects from a multinomial logit modelDear members of the list, I am trying to plot the marginal effects from a multinomial logit model. …
Difference in Difference Approach for Panel datahi I performed a Lab experiment on 34 people (17 in control and 17 in treatment). I played 3 rounds …
Is there a particular reason why Stata under Linux doesn't export .wmf files?Fellow Statalisters (especially StataCorp): Is there a particular reason why, in Stata under Linux,…
Calculating the number of new investments of a VC in a specific industry in 5 years prior to the focal investment (observation)I am using Stata 15.0 I hope somebody can help me, given that I have been struggling for a lot of t…
Horizontal bar graph with SDDear Stata users, I am wondering, is there anyway to create horizontal bar graph with SD using -ser…
Subscribe to:
Post Comments (Atom)
0 Response to Datetime variable
Post a Comment