function tramolin (series sername) set force_decpoint on scalar nobser = \$nobs scalar ausprim = firstobs(sername)-firstobs(t) #ID 11/10/07 scalar ausp1 = ausprim+1 scalar ausfin = lastobs(t)-lastobs(sername) scalar ausf1 = lastobs(sername)+1 if WIN32 outfile --write "@tramodir\sername" else outfile --write "@tramodir/sername" endif printf "sername\n" printf "%.8g %.8g %.8g %.8g\n", nobser, 1960, 1, \$pd loop j=1..nobser --quiet if missing(sername[j]) printf "-99999\n" else printf "%.8g\n", sername[j] end if endloop printf "\$INPUT RSA=3 \$\n" printf "\n" outfile --close #******To solve the problem of missing data at the beginning or #******end of the sample: if WIN32 outfile --write "@tramodir\ausentesp" else outfile --write "@tramodir/ausentesp" endif if ausprim!=0 loop j=1..ausprim --quiet print "NA" endloop endif outfile --close if WIN32 outfile --write "@tramodir\ausentesf" else outfile --write "@tramodir/ausentesf" endif if ausfin!=0 loop j=1..ausfin --quiet print "NA" endloop endif outfile --close #************ if WIN32 set shelldir @tramodir\graph\series ! del /Q *.t && cd @tramodir && @tramo -i sername -k sername.ser && cd @tramodir\graph\series && echo "ser_adj" > sername.txt ! type "@tramodir\ausentesp" >> sername.txt ! if exist xlin.t. (more +6 xlin.t >> sername.txt) else (more +6 xorigt.t >> sername.txt) ! type "@tramodir\ausentesf" >> sername.txt append "@tramodir\graph\series\sername.txt" else set shelldir @tramodir/graph/series ! rm -f *.t ! cd @tramodir && @tramo -i sername -k sername.ser > /dev/null ! cd @tramodir/graph/series && echo "ser_adj" > sername.txt ! cat "@tramodir/ausentesp" >> sername.txt ! if [ -e "xlin.t" ]; then tail --lines=+7 xlin.t >> sername.txt ; else tail --lines=+7 xorigt.t >> sername.txt ; fi ! cat "@tramodir/ausentesf" >> sername.txt append "@tramodir/graph/series/sername.txt" endif series diferencia = sername - ser_adj scalar suma = sum(diferencia) if suma=0 setinfo ser_adj -d "Original" else setinfo ser_adj -d "Linearized" endif set force_decpoint off return series ser_adj end function ## example call open data9-7.gdt QNC_adj = tramolin(QNC)