declare hash Customer (dataset: 'certadv.orderfact', ordered: 'descending'); ...statements.. declare hiter C('Customer');
declare hash Customer(dataset: 'certadv.orderfact', ordered: 'descending');
customer.definekey('TotalRetailPrice', 'CustomerID'); customer.definedata('TotalRetailPrice', 'CustomerID', 'ProductID'); customer.definedone();
declare hiter C('customer');
Method
|
Description
|
Syntax
|
Example
|
---|---|---|---|
FIRST
|
Returns the first data
value in the underlying hash object.
|
object-name.FIRST(
);
|
declare hiter C('customer');
<more SAS code>;
C.first();
|
LAST
|
Returns the last data
value in the underlying hash object.
|
object-name.LAST(
);
|
declare hiter C('customer');
<more SAS code>;
C.last();
|
NEXT
|
Returns the data components
in key order.
Note: If you use the NEXT method
without the FIRST method, it returns the first item in the hash object.
|
object-name.NEXT(
);
|
C.first();
<more SAS code>;
C.next();
C.next(); |
PREV
|
Returns the data components
in reverse key order.
|
object-name.PREV(
);
|
C.prev(); |
data work.topbottom;
drop i;
if _N_=1 then do;
if 0 then set certadv.Orderfact (keep=CustomerID
ProductID TotalRetailPrice);
declare hash customer(dataset: 'certadv.Orderfact',
ordered: 'descending');
customer.definekey('TotalRetailPrice', 'CustomerID');
customer.definedata('TotalRetailPrice', 'CustomerID',
'ProductID');
customer.definedone();
declare hiter C('customer');
end;
C.first();
do i=1 to 2;
output work.topbottom;
C.next();
end;
C.last();
do i=1 to 2;
output work.topbottom;
C.prev();
end;
stop;
run;