Announcement

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

  • Formatting date for time series analysis

    Dear all,
    I have time series data, which I imported from Excel. However, the data has monthly dates and of course they are string. Now, I have tried changing them to SIF so that I can run cointegration tests but without success. I've done this for more than a week but with no good progress. Members, please help me. Whichever command I've used from stata help and internet, stata always indicates it has problems. The date is in this format:
    2005m7
    2005m8
    2005m9
    2005m10
    2005m11
    2005m12

    Thank you

  • #2
    Welcome to Statalist, Ronald. We can better help you if we know what commands you have tried and what Stata told you to indicate that there was a problem. Please review the Statalist FAQ linked to from the top of the page, especially sections 9-12 on how to best pose your question. It's particularly helpful to copy commands and output from your Stata log window and paste them into your Statalist post using CODE delimiters, as described in section 12 of the FAQ.

    With that said, here's an example of converting strings to SIF monthly dates with an appropriate format to then display the SIF dates in HRF. Perhaps this example can show you where your problem arose.
    Code:
    . clear
    
    . input str8 hrf_date
    
          hrf_date
      1. 2005m7
      2. 2005m8
      3. 2005m9
      4. 2005m10
      5. 2005m11
      6. 2005m12
      7. end
    
    . generate sif_date = monthly(hrf_date,"YM")
    
    . format sif_date %tm
    
    . list, clean noobs
    
        hrf_date   sif_date  
          2005m7     2005m7  
          2005m8     2005m8  
          2005m9     2005m9  
         2005m10    2005m10  
         2005m11    2005m11  
         2005m12    2005m12  
    
    .

    Comment


    • #3
      Ronald - I realize now that you posted this question into the wrong forum. You are in the "Sandbox" forum under the "Forums for learning to use the Forum Software" which is intended for placing test posts. You should post real questions in the "General" forum under the "Forums for Discussing Stata".

      Comment


      • #4
        Thank you William. Sorry for posting my question to a wrong forum. It's because am new to this group and I didn't exactly where to post my question. I've tried using the commands you sent me but still no success.

        Comment


        • #5
          Ronald - I see that you have reposted the question to the General forum, where more people will see it. That is good, but you really must read the Statalist FAQ as I advised in my initial post. You see that your first response to your new post made exactly that recommendation as well. The Statalist FAQ will tell you

          Never say just that something “doesn't work” or “didn't work”, but explain precisely in what sense you didn't get what you wanted.
          In response to your reply that you have no success with the advice I gave, all I can say is that I don't understand what problem you are having, because the example works perfectly.

          Obviously, my example doesn't address your problem, but your question doesn't explain your problem well enough for anyone to do more than guess what the problem is.

          Comment

          Working...
          X