Announcement

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

  • Trouble with date function

    Hey, this is my first post in here, I hope I can master this software and later on help others.
    So right now I´m working with panel data, but I have a problem, since the date function isn´t giving me the right dates
    I have a data base like this one
    FID Time C UGM t
    0 1/1/2015 25 72749 02/3634
    0 1/2/2015 16 72749 09/3636
    0 1/3/2015 12 72749 01/3639
    0 1/4/2015 19 72749 08/3641
    0 1/5/2015 14 72749 02/3644
    0 1/6/2015 15 72749 09/3646
    0 1/7/2015 19 72749 03/3649
    0 1/8/2015 17 72749 10/3651
    0 1/9/2015 18 72749 05/3654
    0 1/10/2015 24 72749 11/3656
    0 1/11/2015 19 72749 06/3659
    0 1/12/2015 73 72749 12/3661
    0 1/1/2016 79 72749 07/3664
    0 1/2/2016 37 72749 02/3667
    0 1/3/2016 26 72749 07/3669
    0 1/4/2016 42 72749 02/3672
    0 1/5/2016 35 72749 08/3674
    0 1/6/2016 37 72749 03/3677
    0 1/7/2016 28 72749 09/3679
    Clearly neither of us have been in year 3634, so something is not right

    My code is

    Code:
    gen t = date(Time,"DMY")
    
    format %tmNN/CCYY t
    I would thank you very much if you could help me

    Thanks

  • #2
    The problem lies in your format. The format for a daily date starts with

    Code:
    %td
    whereas your format can only apply to a monthly date, as it starts with

    Code:
    %tm

    Comment

    Working...
    X