function tramolin (list xlist, scalar T, scalar anyo, scalar startp) if nelem(xlist) = 0 funcerr "The list of variables cannot be empty" end if if (!isstring(tramo) | !isstring(tramodir)) funcerr "The strings 'tramo' and 'tramodir' must be defined" end if # initialize return list list llist = null loop foreach i xlist --quiet outfile --write "@tramodir/$i" printf "$i\n" printf "%.8g %.8g %.8g %.8g\n", T, anyo, startp, $pd loop j=1..T --quiet if missing($i[j]) printf "-99999\n" else printf "%.8g\n", $i[j] end if end loop printf "$INPUT RSA=3 $\n\n" outfile --close # Get tramo to process the series ! cd @tramodir && @tramo -i $i -k $i.ser # Write a data file suitable for gretl sprintf vname "%.11s_lin", "$i" outfile --write "@tramodir/graph/series/@vname.txt" printf "@vname\n" outfile --close ! cd @tramodir/graph/series && tail --lines=+7 xlin.t >> @vname.txt append "@tramodir/graph/series/@vname.txt" list llist = llist @vname end loop return list llist end function open data9-9 scalar T = nobs(nocars) scalar anyo = 1959 # startp: start period scalar startp=1 list xlist = price primert string tramodir = "/home/cottrell/gretl/tramo" string tramo = "/opt/tramo/tramo" list linlist = tramolin(xlist, T, anyo, startp) varlist print xlist linlist --byobs