| Date: | Thu, 7 May 2009 17:10:25 -0500 |
| Reply-To: | "Data _null_;" <iebupdte@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Data _null_;" <iebupdte@GMAIL.COM> |
| Subject: | Re: Array sorting |
|
| In-Reply-To: | <f5408140-4fe7-452a-85a1-a3aebf757cc1@o20g2000vbh.googlegroups.com> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
I would fix it this way. Others may be willing to help you with your code.
data sortme;
array Arr(8) (47 14 51 12 75 4 5 5);
call sortN(of arr[*]);
run;
On 5/7/09, Francogrex <franco@grex.org> wrote:
> Why this below is giving an error and how to fix it. thanks.
>
> data sortme;
> array Arr(8) (47 14 51 12 75 4 5 5);
> do j=2 to dim(Arr);
> key = Arr(j);
> i = j - 1;
> do while((i > 0) & (Arr(i) > key));
> Arr(i+1)=Arr(i);
> i= i - 1;
> end;
> Arr(i+1)= key;
> end;
> run;
>
> proc print data=sortme;
> run;
>
|