Sybase IQ supports user-defined aggregate functions (UDAFs). The SUM function is an example of a built-in aggregate function. A simple aggregate function produces a single result value from a set of argument values. You can write UDAFs that can be used anywhere the SUM aggregate can be used.
The aggregate UDF examples referenced here are installed with the IQ server, and can be found as .cxx files in $IQDIR15/samples/udf. You can also find them in the $IQDIR15/lib64/libudfex dynamically linkable library.