Announcement

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

  • Dates Conversion

    I am working with 'dates' in the following format (Day-Month-year):
    01-07-03
    01-07-03
    01-07-03
    01-07-03
    01-07-03
    01-07-03
    09-07-03
    09-07-03
    09-07-03
    10-07-03
    10-07-03
    10-07-03
    14-07-03
    14-07-03
    15-07-03
    15-07-03
    15-07-03
    17-07-03
    17-07-03
    I actually want to extract month and year from the dates but given the format I am unable to do so. Kindly help how can I extract month and year from these dates or possibly convert them to another format, which makes it easier to work in Stata. Thank You.

  • #2
    What you have given us is probably what you see, but that is not necessarily what you got. The answer to your question depends on exactly what you got. To give us that use dataex create an example of your data that you can share with us.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Maarten Buis is correct, as usual. To the point: what you show is consistent with

      1. your variable being string

      or

      2. your variable being numeric with a specific display format

      or

      3. your variable being numeric with value labels

      or

      4. (we do see this in posts sometimes) your dates being not yet in Stata and you are wondering how to deal with them once they are.

      The code differs in each case and you shouldn't want us to write code for all of those cases. Using dataex would show that the data are in Stata and precisely how they are held.

      I looked at your previous posts and found several in which you had explicit advice to read and act on https://www.statalist.org/forums/help#stata -- and that request still stands.
      Last edited by Nick Cox; 29 May 2019, 03:06.

      Comment

      Working...
      X