Announcement

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

  • Covert numeric daily date to stata date

    I have the dates in the following form (MM/DD/YY):
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int date_1
    14579
    14610
    14641
    14670
    14701
    14731
    14762
    14792
    14823
    14854
    14884
    14915
    14945
    14976
    15007
    15035
    15066
    15096
    15127
    15157
    15188
    15219
    15249
    15280
    15310
    15341
    15372
    15400
    15431
    15461
    15492
    15522
    15553
    15584
    15614
    15645
    15675
    15706
    15737
    15765
    15796
    15826
    15857
    15887
    15918
    15949
    15979
    16010
    16040
    16071
    16102
    16131
    16162
    16192
    16223
    16253
    16284
    16315
    16345
    16376
    16406
    16437
    16468
    16496
    16527
    16557
    16588
    16618
    16649
    16680
    16710
    16741
    16771
    16802
    16833
    16861
    16892
    16922
    16953
    16983
    17014
    17045
    17075
    17106
    17136
    17167
    17198
    17226
    17257
    17287
    17318
    17348
    17379
    17410
    17440
    17471
    17501
    17532
    17563
    17592
    end
    format %tdNN/DD/YY date_1
    Could someone please let me know how to convert them to daily Stata dates. Thank you.

  • #2
    There is nothing to convert to daily dates. These are Stata daily dates.

    That said, it's manifest that these are likely to be daily dates coding monthly data, so that you will make progress with

    Code:
    gen mdate = mofd(date_1) 
    format mdate %tm
    Otherwise you will have the most awful mess as these dates are irregularly spaced and between 28 and 31 days apart and few things in Stata will go right if you leave them as they are. It's clear to a person that these are really monthly dates but Stata needs to be told that.

    Comment

    Working...
    X