Hey, I have been looking for an answer but did not really find one and therefore hope to gain some knowledge here. I am working with a panel dataset including firms from all around the world. I need to convert two variables, a firm's total assets and a firm's r&d expenditure, into USD from various other currencies. In theory, I can just create a new variable by dividing e.g. the total assets by the exchange rate. This works only if the exchange rate is higher than one though. On the other hand I could multiply the value of total assets by the exchange rate if the exchange rate is lower than one. Basically, I am looking for a code that allows me to implement an if condition that divides total assets by the exchange rate IF it is higher than 1 and multiplies IF lower than 1.
I am thinking about something like the following:
gen assetsUSD = TA / FX if FX > 1 & TA * FX if FX < 1
(TA = Total assets & FX = Exchange rate)
I did not use the dataex yet as I thought it might be solvable without looking at the specific data.
Highly appreciate any help!
I am thinking about something like the following:
gen assetsUSD = TA / FX if FX > 1 & TA * FX if FX < 1
(TA = Total assets & FX = Exchange rate)
I did not use the dataex yet as I thought it might be solvable without looking at the specific data.
Highly appreciate any help!

Comment