Tuesday, September 22, 2009

CALL SORTx routines

With CALL SORTx routines, we can sort and EXCHANGE the values of the variables. It is a very helpful since we need not assign a temporary variable for exchange of the values.
Below is an interesting sample code:

* Get the first two max height values;
data _null_;
set sashelp.class end=last;
retain max1 max2;

call sortn(height, max2, max1);
if last then put "max height value: " max1 max2;
run;

No comments: