I have a number of macro variables that are common and are only differentiated in their names by adding the ISO country code. Variables are in time series format. That is for inflation and GDP in Australia, the USA, and Canada, which would be
Code:
AUS_inflation CAN_inflation USA_inflation AUS_gdp, CAN_gdp USA_gdp
etc.
There are about one hundred countries and fifty such variables. What I need is to rename all variables by replacing the underscore ( _ )with a dot . That should look like
Code:
AUS.inflation, USA.inflation, CAN.inflation AUS.gdp CAN.gdp USA.gdp
And then create first differences for all of them, How is that done? I tried for example the following, but it failed

Code:
foreach var in AUS_inflation- USA_gdp{
    gen D`var'= D.`var'
}
Thank you

Best

Giorgio