Announcement

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

  • Differences in value depending on date

    Hello everyone!

    I'm struggling to make stata to add and subtract dates from certain other dates. For example: using CRSP data on Apple stock prices I would like to be able to find stock price for certain date (t=0) and the stock price 5 days before (t=-5) and 5 days after (t=+5) that date. I need the absolute and relative differences between those values. What is the best command to use?

    Thank you in advance,

    Frank
    Attached Files

  • #2
    If you xtset your data, you can use the lag and difference operators. See help xtset and help tsvarlist
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      https://www.stata.com/support/faqs/d...ged-variables/

      Comment


      • #4
        But you also need a business calendar given the lack of data at weekends.

        Comment


        • #5
          Originally posted by Nick Cox View Post
          But you also need a business calendar given the lack of data at weekends.
          I do agree with Nick.
          See here for more info.

          Comment


          • #6
            Thanks for your quick responses, this helped a lot!

            Comment

            Working...
            X