Hello everyone,

I would like to translate one of my variables (ValueUSD) into values in EUR, depending on the respective quarter of the year.
For this purpose, I thought I could write the following:

Code:
foreach v of varlist ValueUSD {    
    replace `v' = `v' * 1.1617 if Quarter == "1997q1"
    replace `v' = `v' * 1.1300 if Quarter == "1997q2"
}
but obviously, it's a type-mismatch, as quarter is (not a string but) a float. So can I change the quarter variable to make things fit for purpose?

Here's an example:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float Quarter str33 Investor double(Position ValueUSD Percent)
215 "APG"     23074391 395889633.83 .005184
216 "APG"     23074391 395889633.83 .005184
217 "APG"     23074391 395889633.83 .005184
218 "APG"     23074391 395889633.83 .005087
239 "APG"     28310184 461851283.03 .005946
240 "APG"     28310184 461851283.03 .005946
188 "Allianz" 34574166 572052264.57 .007928
189 "Allianz" 35391914 655950884.96 .008115
190 "Allianz" 36110061 710082928.09 .008279
191 "Allianz" 40653336 898150506.93 .009321
end
format %tq Quartal
Thanks again!
Toni