I have a data set that have over thousands observations and over ten variables, and all values are numeric.
what I need to do is find out the top 6 bigger values for each observation.
Any feedback would be greatly appreciated
Did you mean the top 6 values for each variable? Then why not use PROC UNIVARIATE.
no, the top 6 values in on observation.
Sample data and output are always helpful in determining requirements.
Perhaps LARGEST function.
I am not clear on your final output, so this is just a idea that you may start upon, after conversion, n5-n10 will be the top 6 bigger value for each row.
%macro have;
data have;
do row=1 to 5;
%do i=1 %to 10;
n&i=ranuni(0);
%end;
output;
end;
run;
%mend;
%have;
data want;
set have;
array n(10) n:;
call sortn(of n(*));
/* put n5-n10;*/
run;
Haikuo
For a descending sort you can use a descending enumerated range.
Thanks, Null. Did not think of that.
Haikuo
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.