(: file: pop_2000_and_later_by_year.xq date: 29-July-2010 author: Gary Lewis purpose: Identifies institutions to include in the warehouse for years 2000 and later. 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 2000 and later. 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_2000_and_later_by_year.xq -o pop_2000_and_later.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 >= 2000 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, $deggrant := if ($x/@deggrant = "") then -999 else $x/@deggrant, $pset4flg := if ($x/@pset4flg = "") then -999 else $x/@pset4flg where $fips > 0 and $fips <= 56 and $sector > 0 and $sector != 99 and $deggrant = 1 and $pset4flg = 1 return } }