Announcement

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

  • converting modate format string to numeric

    Dear All,

    I have the data which is in the following format. The modate is in string format. The data looks like follows:

    Click image for larger version

Name:	dataformat.png
Views:	1
Size:	12.4 KB
ID:	1694621



    The dates are arranged as per the individual id. How to convert it to the numeric so that i can declare my data set into panel data?

    Looking forward to your suggestions

    With sincere regards,
    Upananda Pani
    Last edited by Upananda Pani; 22 Dec 2022, 22:00. Reason: panel

  • #2
    Check out the -monthly()- function, which in my experience is a bit lame compared to the -date()- function. Then check out the user contributed command -numdate- which works better with monthly dates.

    If you do not figure it out, post a sample of your data using -dataex-.

    Comment


    • #3
      monthly() can indeed fail where one might expect the problem is easy, but it will work fine here.

      Code:
      . di monthly("2004m1", "YM")
      528
      
      . di monthly("200401", "YM")
      .
      Code:
      
      


      The real problem here is likely to be trying to work with date variables without reading


      help datetime

      first.

      Comment

      Working...
      X