Announcement

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

  • Very easy question but troubleing me...

    Hi guys, I am a new STATA user and I want to ask a very amateur question about date and formatting. I have my variable, "dateforstata", with label, "Date for Stata", type, "str10", and Format, "%10s". I also tried to follow videos, like this one, "https://www.youtube.com/watch?v=UxU3zKfedmA&ab_channel=MadeEasy" but it doesn't work because my original data is already red (numeric variable turns into a string). There are around 4500 observations for this variable and it would take ages for me to correct them. It is much appreciated if anyone can provide me with a solution... If there is anyone familiar with this question and is also free, would you mind writing me your suggested solution?

    Many thanks,

    Jeffrey Tse

  • #2
    This seems to mean that you have a string date variable that you don't know how to convert to a numeric date. So, please follow https://www.statalist.org/forums/help#stata and give us a data example, While visiting please swing by https://www.statalist.org/forums/help#spelling

    Code:
    help datetime 
    is where to find out more.

    Comment


    • #3
      Show a sample of your data using -dataex-, and explain how you want this data to be.

      Comment


      • #4
        Stata's "date and time" variables are complicated and there is a lot to learn. If you have not already read the very detailed Chapter 24 (Working with dates and times) of the Stata User's Guide PDF, do so now. If you have, it's time for a refresher. After that, the help datetime documentation will usually be enough to point the way. You can't remember everything; even the most experienced users end up referring to the help datetime documentation or back to the manual for details. But at least you will get a good understanding of the basics and the underlying principles. An investment of time that will be amply repaid.

        All Stata manuals are included as PDFs in the Stata installation (since version 11) and are accessible from within Stata - for example, through the PDF Documentation section of Stata's Help menu.

        Comment


        • #5
          I figured it out after few hours attempt... Anyway thank you all very very much!

          Comment

          Working...
          X