(: file: verify_nces_des2009_table265_1996-1997.xq date: 08-Jun-2010 author: Gary Lewis purpose: Used to verify the counts of degree-granting institutions for years 1996 and 1997 in Table 265 of the NCES Digest of Education Statistics, 2009. Verifying published table values is an important way to ensure that we're using the same definitions that NCES used. Table 265 is located at: http://nces.ed.gov/programs/digest/d09/tables/dt09_265.asp?referrer=list use: Run from the path where the program is located. Output goes to the screen. xml_filename refers to the data file containing directory data for a specific year. The path to xml_filename should be given in relationship to the path locaton of this program. notes: 1. The c* values in the output refer to columns in Table 265; ie, c2 refers to column 2. 2. The "if" conditionals are an unconventional way to get frequency distributions, but they do allow verification of an entire row of results in Table 265 at one time. example: zorba -e xml_filename:="../data/1996/ic9697_A/ic9697_a.xml" -f -q verify_nces_des2009_table265_1996-1997.xq -z index=yes :) declare variable $xml_filename external; { let $tmp := for $x in fn:doc($xml_filename)/data/record let $unitid := $x/@unitid, $fips := if ($x/@fips = "") then -999 else xs:integer($x/@fips), $sector := if ($x/@sector = "") then -999 else xs:integer($x/@sector), $iclevel := if ($x/@iclevel = "") then -999 else xs:integer($x/@iclevel), $control := if ($x/@control = "") then -999 else xs:integer($x/@control), $hdegoffr := if ($x/@hdegoffr = "") then -999 else xs:integer($x/@hdegoffr), $opeind := if ($x/@opeind = "") then -999 else xs:integer($x/@opeind), $c2 := 1, $c3 := if ($iclevel = 1) then 1 else 0, $c4 := if ($iclevel = (2,3)) then 1 else 0, $c5 := if ($control = 1) then 1 else 0, $c6 := if ($control = 1 and $iclevel = 1) then 1 else 0, $c7 := if ($control = 1 and $iclevel = (2,3)) then 1 else 0, $c8 := if ($control = (2,3)) then 1 else 0, $c9 := if ($control = (2,3) and $iclevel = 1) then 1 else 0, $c10 := if ($control = (2,3) and $iclevel = (2,3)) then 1 else 0, $c11 := if ($control = 2) then 1 else 0, $c12 := if ($control = 2 and $iclevel = 1) then 1 else 0, $c13 := if ($control = 2 and $iclevel = (2,3)) then 1 else 0, $c14 := if ($control = 3) then 1 else 0, $c15 := if ($control = 3 and $iclevel = 1) then 1 else 0, $c16 := if ($control = 3 and $iclevel = (2,3)) then 1 else 0 where $fips > 0 and $fips <= 56 and $sector > 0 and $hdegoffr > 0 and $opeind = (1,2) return return }