Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Minutes & Seconds - display when there is a single digit second

    Hi. I'm not that experienced at doing analysis with dates/times. I just want to make sure I'm interpreting the below 4:9 and 1:2 correctly. I have formatted the output for minutes:seconds and at first I thought the 9 in 4:9 was an implausible value. I checked my code and everything looks good. So now I'm thinking the 4:9 actual means 4 minutes and 9 seconds. Can I get confirmation that if there is a single digit second the 0 before the number does not show? That is, the time is really 4:09 but the 0 before the 9 is not displayed. Similarly am I right in thinking the 1:2 for the standard error would mean 1 minute 2 seconds and not 20 seconds (2:50 has 50 seconds displayed so I think I'm onto something). Thank you in advance for your help. Christy

    mean ptrecdiff, cformat(%tCmm:ss) over(stood)

    Mean estimation Number of obs = 71

    _subpop_1: stood = A. sat
    _subpop_2: stood = B. stood

    --------------------------------------------------------------
    Over | Mean Std. Err. [95% Conf. Interval]
    -------------+------------------------------------------------
    ptrecdiff |
    _subpop_1 | 4:9 1:22 1:25 6:53
    _subpop_2 | 2:50 1:2 0:45 4:56
    --------------------------------------------------------------

  • #2
    You haven't said how ptrecdiff is defined. We certainly don't have any information about it that you don't.

    The implication is that it's a difference between two times, so as such in milliseconds. Why not just compare your results with unformatted output, so that you can work out what each format implies? Conversely, if it's not a time in ms, any %tc or %tC formats will just be wrong.
    Last edited by Nick Cox; 16 Dec 2014, 17:56.

    Comment


    • #3
      It looks like you are interpreting these correctly. But I think you will find it more natural to use the format %tCMM:SS, (note upper case) so that Stata will supply the leading zeroes you are accustomed to seeing.

      Comment


      • #4
        Hi Nick, Below is the code I used to create the variables. The raw data was exported from a REDCap database into a CVS file then into Stata using an insheet command. The data were data entered into REDCap using their hr:min:sec variable format and initially in Stata they were a string variable, as you can tell from the code. The unformatted analysis doesn't make sense to me from an interpretation standpoint. But isn't my question relative straightforward - that is, if the formats are correct doesn't 4:9 mean 4 minutes and 9 seconds? Thanks, Christy

        gen pttime2 = clock(pttime, "hms")
        format pttime2 %tCmm:ss
        lab var pttime2 "pt rept time spent"

        gen rectime2 = clock(rectime, "hms")
        format rectime2 %tCmm:ss
        lab var rectime2 "actual time spent"

        gen ptrecdiff = pttime2-rectime2
        format ptrecdiff %tCmm:ss
        lab var ptrecdiff "diff pt & actual time"

        Comment


        • #5
          Sorry, but I have no idea what a REDCAP database or a CVS file is. Perhaps you mean comma-separated values.

          But in this case I am more concerned with giving you a method to solve your own problem, which I take to be understanding your own output.

          I don't understand what is difficult about milliseconds. 4 min 9 s is 249 s or 249000 ms. Minutes and seconds may naturally be much more convenient or conventional, but milliseconds are surely not difficult. You can test the effects of a display format with simple examples, so you can check that (e.g.)

          Code:
           
          . di %tCmm:ss 249000
            4:9

          Comment


          • #6
            Clyde, Thank you for your response. I made this change and indeed my results are 04:09. Nick, thanks for that line of code - I hadn't thought of checking it that way and didn't know the code to do so. I verified the unformatted milliseconds in my results (249566.7) is 4 minutes and 9 seconds. It's nice to know how to double-check this. My question is answered and problem solved.

            By the way, REDCap is an NIH (National Institute of Health)-funded research electronic data capture software use by an increasing number of epidemiologists and health researchers in academics to get data collected and entered. You can export data directly from REDCap into Stata (or other software). http://www.project-redcap.org/
            And yes, I meant CSV, comma-separated values.

            Comment


            • #7
              Thanks for the closure here and for filling the small gaps.

              Comment

              Working...
              X