Examples / INFLUNEM.RPF |
INFLUNEM.RPF is an example of repetitive analysis. It does an overlay graph of unemployment and inflation for seven countries.
The data are on a RATS format file with a pattern of names which have a three character country prefix followed by suffixes of "SUR" (Standardized Unemployment Rate) and "DEFLS" (for price deflator).
This loops over the country prefixes, with pseudo-code
declare label country
dofor country = "can" "deu" "fra" "gbr" "ita" "jpn" "usa"
read deflator and unemployment for country prefix
create inflation
do overlay graph
end dofor
We re-use series names PRICE, SUR and INFLATION for each country. Because different countries have different data ranges, we use the CLEAR instruction before reading a country's data. We use the redirection on DATA to read data with the created data series names into the target series (PRICE and SUR). Because the redirection wants a string literal, we use the & prefix on the constructed string. We create an annualized inflation rate from the deflator.
clear price sur
data(format=rats) / sur<<&country+"sur" price<<&country+"defls"
set inflation = 400.0*log(price/price{1})
The INQUIRE instruction determines the maximum range over which both inflation and unemployment are defined and those are used in the GRAPH instruction.
inquire(regressorlist) n1 n2
# sur inflation
graph(header="Inflation vs Unemployment for "+%strupper(country),overlay=line) 2
# sur n1 n2
# inflation n1 n2
Full Program
open data oecddata.rat
cal(q) 1960:1
all 1998:4
declare label country
dofor country = "can" "deu" "fra" "gbr" "ita" "jpn" "usa"
clear price sur
data(format=rats) / sur<<&country+"sur" price<<&country+"defls"
set inflation = 400.0*log(price/price{1})
inquire(regressorlist) n1 n2
# sur inflation
graph(header="Inflation vs Unemployment for "+%strupper(country),overlay=line) 2
# sur n1 n2
# inflation n1 n2
end dofor
Graphs
(One of seven)
Copyright © 2025 Thomas A. Doan