(: file: gen_fileList.xq date: 24-June-2010 author: Gary Lewis purpose: Generates a text file that contains a list of a specified IPEDS file type (choices are SPS, SAS, DO) that contain variable metadata on data type, field width, and descriptions. use: Run program from its location. notes: 1. An SPS file is an SPSS statistical program that IPEDS supplies. SAS is a SAS program. DO is a Stata program. example: zorba -f -q gen_fileList.xq -o "../txt/spsList.txt" --serialize-text revision history: date: 21-September-2010 revised: 1. Restricted file type to SPS for the IPEDS data file containing variable metadata. The SPSS metadata seems easier to use than the Stata or SAS metadata. 2. Removed restriction that the IPEDS data file is a directory file. NOTE: It is important that IPEDS data files under ~/rwebdb/project/ipeds/data only include those that will be used for processing variables headed for the warehouse. :) declare variable $fileType := "sps"; { for $i in doc("/home/gml/rwebdb/projects/ipeds/xml/metadata/ipedsData.xml")/data/file[@type = $fileType] let $name := $i/@name, $path := $i/@path, $name_wo_ext := substring-before($name, ".") let $j := doc("/home/gml/rwebdb/projects/ipeds/xml/metadata/ipedsFiles.xml")/ipedsFiles/file[@csvName = $name_wo_ext], $year := $j/@year, $spsFile := concat($year, " ", $path, $name, " ") order by $year return text{$spsFile} }