Announcement

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

  • Percentage change of daily exchange rate data

    Hello everyone,

    I am writing my dissertation thesis on the impact of Brexit negotiations on the value of the pound in 2019. To do this, I am empirically testing the change in several exchange rates as a result of news developments concerning Brexit.

    I would like to create a variable using the current exchange rate data I have to calculate and illustrate the daily change in the exchange rate on days affected by Brexit and contrast these with dates not affected by Brexit.

    My data has the 'open price' and 'close price' of certain exchange rates per day as two separate variables (see below) alongside the date as a float variable.

    open
    1st day - 1.275234
    2nd - 1.251878
    3rd - 1.262897
    4th - 1.273285
    5th - 1.278691

    close
    1st day - 1.275429
    2nd - 1.252191
    3rd - 1.262881
    4th - 1.273496
    5th - 1.278609

    I essentially would like to create a variable which performs the basic percentage change formula (Close - Open / Open (x100) ) for each day of my data.

    Any guidance on how to create such a variable would be much appreciated.

  • #2
    You just do what you said yourself:

    Code:
    gen double perchange = 100*(close-open)/open
    If you are asking something more complicated check out -dataex-

    and post sample of your data.

    Comment


    • #3
      That worked great thank you! I'm quite new to this so didn't realise how simple it was.

      Much appreciated, cheers

      Comment


      • #4
        In addition to this - how would I be able to create the same variable, but this new variable being a percentage change between the 'close price' of the previous day?

        I.e. a variable with the rate of returns formula, which in this instance would be a formula of: Close - Close-1 / Close-1

        Any guidance would be much appreciated

        Comment

        Working...
        X