//
//transpose command
//
//this command is used to change variable name.
//Syntax
transpose [variables]
//Example Calcation year default rate by rating.
//Read time series of company default in USA by rating.
get haz2.csv@;
//Calcurate time series of remain company.
vector tim[12];
vector zan[12];
for(i=1;i<=12;i++) {
if(i == 1) {
zan[i] = init - tim[i];
}
else {
zan[i] = zan[i-1] - tim[i];
}
}
//Calcurate time series of yearly default rate as default divided by last year remain.
vector rate[12];
for(i=1;i<=12;i++) {
if(i == 1) {
rate[i] = tim[i]/init;
}
else {
rate[i] = tim[i]/zan[i-1];
}
}
select rate_1-12;
//Execute transpose time series for plot.
transpose;
//Plot time series of yearly default rate by rating.
plot line col_1-9;