#!/bin/bash #You may need to change the first line to point to your bash location rm gsoep.s rm gsoep23.v* rm gsoep23.zoo rm gsoep23.bak #You may need the path of your gsoep23.zoo file here, e.g. #echo '/export/home/soep/gsoep23.zoo' > gsoep23.s echo 'gsoep23.zoo' > gsoep23.s FN=1 for f in *.por ; do #Read the *.por files into tda, write out an ascii data file #(with extension .dat), add variable descriptions to gsoep23.v, #add a file description to the archive description file gsoep23.s #using the logical file number $FN tda "rspss(ns=1,dvara(fn="${FN}")=gsoep23.v,arcda=gsoep23.s,df="${f/por/dat}")="${f} ; #add the ascii data file to the zoo archive zoo ah gsoep23 ${f/por/dat}; #remove the ascii file rm ${f/por/dat}; #increase the file counter FN=$((1+FN)) done #Variable names within an archive must be unique. Force uniqueness by #appending the logical file number if necessary. The variable #description file with unique variable names is written to gsoep23.var #Uncomment this if you use versions of TDA prior to 6.4g #tda "arcvc(df=gsoep23.var)=gsoep23.v" #From TDA version 6.4g onward, you might choose to force uniqueness by #appending the name of the file: #opt=2 append file name, lower case #opt=3 append file name, upper case tda "arcvc(opt=2,df=gsoep23.var)=gsoep23.v" #Add a file decription for the variable description file to the #archive description file echo 999 gsoep23.var 2 0 `cat gsoep23.var | wc -l ` 0 >> gsoep23.s #Add the archive description file to the archive. This is only #necessary if you want to move a complete archive around. When working #with the archive, a copy of the archive description file gsoep23.s #must exist outside the zoo archive. Its first line has to provide #the full path to the zoo archive if you are working from a different #directory. zoo ah gsoep23 gsoep23.s #Add the variable descriprion file zoo ah gsoep23 gsoep23.var #Pack the zoo archive zoo PP gsoep23 #Now check the integrity of the zoo archive by running #> tda arcd=gsoep23.s arcc #from your shell #If this gives "No errors found" you may savely delete the *por files