(: OBSOLETED! date: 22-June-2010 author: Gary Lewis notes: 1. Program no longer necessary when eliminated the 25 distinct_unitids_by_year.xml files (1 file for each year in the time series). 2. See count_distinct_unitids_all_years_v2.xq for more details. :) (: file: distinct_unitids_by_year.xq date: 14-May-2010 author: Gary Lewis purpose: Creates an XML file that contains the distinct unitids in the data file. In a subsequent xquery program, the data files for each year can be combined to provide a list of the distinct unitids across all the IPEDS data files. usage: Program should be run from directory in which it is located. Use path locations relative to the program for the locations of the xml data file, ipedsFiles.xml, and the output file. example: zorba -e xml_filename:="../2008/HD2008/hd2008.xml" -e xml_ipedsFiles:="../xml/metadata/ipedsFiles.xml" -f -q distinct_unitids_by_year.xq -o ../2008/HD2008/distinct_unitids_by_year.xml -z indent=yes revision history: 19-May-2010 Gary Lewis Revised to: 1. Reflect change in directory structure for xml metadata found in ipedsFiles.xml. :) declare variable $xml_filename external; declare variable $xml_ipedsFiles external; { for $i in fn:doc($xml_filename)/data let $data_file := $i/@file, $year := fn:doc($xml_ipedsFiles)/ipedsFiles/file[@csvName = $data_file]/@year for $unitid in distinct-values($i/record/@unitid) return }