Hello guys. I have two questions regarding my code. The first one is the descending order inside the declare hash statement, which value will be applied to the descending order? I read material online, some people said the order would be applied on all the keys, so in my case, will the order only applied to the "score" variable?
Another question is my code output nothing on the ge90 dataset. But I don't understand the reason? Thanks in advance!
data class_scores;
input name :$9. score @@;
datalines;
Callum 82 Chyou 92
Damien 89 Grace 74
Jorge 99 Kyle 85
Lachlan 83 Lucia 90
Mia 91 Niamh 80
Philipp 89 Tomas 76
;
data top_quarter bottom_quarter ge90;
length name $9 score 8;
keep name score;
if _n_=1 then do;
declare hash h(dataset: 'class_scores', ordered: 'descending');
h.defineKey('score');
h.defineData('score','name');
h.defineDone();
call missing(name, score);
declare hiter hi('h');
end;
count=h.num_items;
n=4;
put count=;
hi.first();
do i=1 to n;
output top_quarter;
hi.next();
end;
hi.last();
do i=1 to n;
output bottom_quarter;
hi.prev();
end;
rc=hi.first();
do while(rc=0);
if socre>90 then output ge90;
rc=hi.next();
end;
run;