I am trying to run the the getfactors.src but i get the error in line 72
new;
library pgraph;
t=122; //lenghth of time series
t1=t+1;
n=3; //number of endogenous variables
l=2; //lag lenghth
horizon=20; //horizon for irf
mreps=500; //no of monte carlo replications
greps=1000; //no of gibbs replications to calculate IRF
a="data.dat";
data=loadd(a);
a="data0.dat";
data0=loadd(a);
betas={};
i=1;
do until i>=cols(data)+1;
ytemp=trimr(data0[.,i],0,0);
xtemp=trimr(data[.,i]~ones(rows(data),1),0,0);
bn=ytemp/xtemp;
betas=betas|bn[1];
i=i+1;
endo;
a="zmat.dat";
zmat=loadd(a);
a="zmat0.dat";
i=1;
zmat0=loadd(a);
ytemp=trimr(zmat0[.,i],0,0);
xtemp=trimr(zmat[.,i]~ones(rows(data),1),0,0);
bn=ytemp/xtemp;
betas=betas|bn[1];
load signs[351,3]=SIGN1.TXT;
pattern=signs;
outdir="D:\\pawel\\output1\\"; ///directory to save excel files that hold irfs this must exist beforehand
open fh1=states.dat for read;
open fh2=vols.dat for read;
open fh3=ch.dat for read;
open fh4=fact.dat for read;
open fh5=salph.dat for read;
open fh6=qmat.dat for read;
open fh7=svv.dat for read;
open fh8=fload.dat for read;
out1={};
out2={};
out3={};
out4={};
out5={};
i=1;
j=1;
k=1;
ii=1;
jj=1;
kk=1;
do until i>=(greps*t)+1;
L1=seekr(fh1,i);
L2=seekr(fh2,j);
L3=seekr(fh3,i);
L4=seekr(fh4,i);
L5=seekr(fh5,k);
L6=seekr(fh6,ii);
L7=seekr(fh7,jj);
L8=seekr(fh8,kk);
beta=readr(fh1,t);
h1=readr(fh2,t1);
ch=readr(fh3,t);
ff=readr(fh4,t);
salph=readr(fh5,(n*(n-1))/2);
q0=readr(fh6,n*(n*L+1));
svv=readr(fh7,1);
fload=readr(fh8,cols(data));
ymat=ff~zmat;
out1=out1~ff[.,1];
out2=out2~ff[.,2];
out3=out3~h1[.,1];
out4=out4~h1[.,2];
out5=out5~h1[.,3];
//call info("iter",jj);
i=i+t;
j=j+t1;
k=k+(n*(n-1))/2;
ii=ii+n*(n*L+1);
jj=jj+1;
kk=kk+cols(data);
endo;
z1=median(out1')~quantile(out1',0.16|0.84)';
z2=median(out2')~quantile(out2',0.16|0.84)';
z3=median(out3')~quantile(out3',0.16|0.84)';
z4=median(out4')~quantile(out4',0.16|0.84)';
z5=median(out5')~quantile(out5',0.16|0.84)';
a="temp.dat";
saved(z1~z2~zmat0,a,0);
b="factors.xls";
exportf(a,b,0);
a="temp.dat";
saved(z3~z4~z5,a,0);
b="svol.xls";
exportf(a,b,0);
proc(1)=exportf(dfile,excelfile,no);
local data,file,range,sheet,vls,ret;
data=loadd(dfile);
file=excelfile;
range="a1";
sheet=1;
vls = reshape(error(0),9,1);
vls[4] = 9999.99;
ret = xlsWriteM(data, file, range, sheet, vls);
retp(ret);
endp;