Hello! I am working on this project, and I need to figure out how to loop this command correctly. I have daily exchange rate data for 80+ countries, all of which are with respect to USD (i.e. EUR/USD, JPY/USD, etc). I would like to create new variables which would allow me to get all exchange rate data for every bilateral pair in my dataset. Obviously, this would be done by dividing the EUR/USD by CNY/USD, which would result in the EUR/JPY exchange rate. Ideally, I would like to create the new variables with appropriate names, i.e. for the example above, the new variable name would be EUR_CNY. I am unsure if this is possible to do with a foreach loop. Sample data below:
It would likely be necessary to get both EUR/CNY and CNY/EUR. Thanks in advance.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str8 timeperiod float(ars eur aud cny) "1/3/2005" 2.9762344 .740357 1.282964 8.276967 "1/4/2005" 2.9779274 .748223 1.294426 8.276992 "1/5/2005" 2.9794314 .756201 1.312311 8.276996 "1/6/2005" 2.9735265 .758553 1.313358 8.277023 "1/7/2005" 2.977273 .757576 1.310682 8.27697 end
Comment