| Date: | Wed, 9 Feb 2011 14:54:41 -0800 |
| Reply-To: | "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV> |
| Subject: | Re: Proc iml question |
| In-Reply-To: | <AANLkTi=WCJj7UbEv_q2APuarvmbUziBpqSHWk7TCHSqH@mail.gmail.com> |
| Content-Type: | text/plain; charset=utf-8 |
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Andrew Agrimson
> Sent: Wednesday, February 09, 2011 2:36 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Proc iml question
>
> Thank you oloolo, but what I'm really interested in are the indices of
> largest five values. For instance, if the vector was:
> {1,4,2,8,9,3,2,8}, and
> I was interested in the top three values, the vector I want would be
> {4,5,8}, which are the indices of the top three values. Do you have any
> thoughts on that?
>
> Andy
>
How about
proc iml;
x={1,4,2,8,9,3,2,8};
call sortndx(ndx, x, 1, 1);
xthree=ndx[1:3];
print xthree;
run;
quit;
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|