Announcement

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

  • How can I convert other currencies that vary over time to USD in Stata?

    Hello,

    I have a dataset in which I have the amount issued by companies in different periods of time and in different currencies. I want to run a regression in which the amount issued by the companines is one of the independent variable. In order to do that I need the amount issued to be comparable, so I want to convert it all into the same currency. Is it possible to do that in an easy way using Stata?

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double originalamountissued str3 principalcurrency int issuedate
    7.500e+08 "EUR" 21846
    1.000e+08 "HKD" 22265
    1.000e+09 "EUR" 21945
    3.000e+08 "HKD" 22330
    1.500e+08 "EUR" 20146
    1.000e+09 "EUR" 22448
    2.000e+08 "HKD" 22308
    7.500e+08 "GBP" 22315
     50000000 "GBP" 22175
    3.000e+08 "HKD" 22265
    1.000e+08 "HKD" 22306
    2.500e+08 "HKD" 22300
    3.000e+08 "HKD" 22257
    4.000e+08 "HKD" 22299
     19600000 "USD" 22148
    1.250e+09 "EUR" 21329
    1.000e+08 "EUR" 21654
    1.000e+08 "GBP" 22175
    1.000e+08 "EUR" 20468
    7.500e+08 "GBP" 22216
    end
    format %tdnn/dd/CCYY issuedate
    Thanks!

  • #2
    The first thing you will need is a data set giving historical exchange rates of currencies against the USD. I believe you can find one at https://fiscaldata.treasury.gov/data...es-of-exchange. You will need to import that into Stata. You will then need to harmonize your currency variable with however your exchange rates data set names the currencies, and perhaps do some operations with your date variable to align it with the dates in the data base.. If you search the internet more deeply than I did, you might be able to find a data base that uses the same currency notation and has dates the match those in your data base, which will save you the latter bit of work.

    Then it's just a matter of -merge-ing your data set with that. The -merge- should be -m:1 currency date-, with the m-side being your data set, and the 1-side being the historical currency exchange rate data set.
    Last edited by Clyde Schechter; 14 Apr 2023, 18:30.

    Comment

    Working...
    X