(: file: pop_1987_to_1995_by_year.xq date: 29-July-2010 author: Gary Lewis purpose: Identifies institutions to include in the warehouse for survey years from 1987 to 1995. 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 1987-1995. 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_1987_to_1995_by_year.xq -o pop_1987_to_1995.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 >= 1987 and $year <= 1995 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, $fice := if ($x/@fice = "") then -999 else $x/@fice where $fips > 0 and $fips <= 56 and $sector > 0 and $fice > 0 return } }