(: file: pop_1996_and_1997_by_year.xq date: 29-July-2010 author: Gary Lewis purpose: Identifies institutions to include in the warehouse for survey years 1996 and 1997. The filters are those used by NCES in Table 265 of the Digest of Education Statistics 2009. notes: 1. Filters vary by IPEDS survey years. This program uses those appropriate for survey years 1996 and 1997. 2. The xml output from this program gets combined with the xml from other surveys years in the XQuery program pop_combined_all_years.xq. usage: Run program from its path location. example: zorba -f -q pop_1996_and_1997_by_year.xq -o pop_1996_and_1997.xml -z indent=yes :) { for $i in fn:doc("../xml/metadata/ipedsData.xml")/data/file[@type = "xml"] let $year := xs:integer($i/@year), $path := $i/@path, $file := $i/@name, $xmlFile := concat($path, $file) where $year = (1996, 1997) order by $year descending return { for $x in fn:doc($xmlFile)/data/record let $unitid := $x/@unitid, $fips := if ($x/@fips = "") then -999 else $x/@fips, $sector := if ($x/@sector = "") then -999 else $x/@sector, $hdegoffr := if ($x/@hdegoffr = "") then -999 else $x/@hdegoffr, $opeind := if ($x/@opeind = "") then -999 else $x/@opeind where $fips > 0 and $fips <= 56 and $sector > 0 and $hdegoffr > 0 and $opeind = (1,2) return } }