Date: Wed, 23 Sep 2009 19:13:43 -0400
Reply-To: oloolo <dynamicpanel@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: oloolo <dynamicpanel@YAHOO.COM>
Subject: Re: programming problem
I just don't understand why SAS doesn't document all of its available
functions, such as the sortc/sortn here, even though these functions have
been discussed on SAS-L for a while
On Wed, 23 Sep 2009 18:43:05 -0400, Arthur Tabachneck <art297@NETSCAPE.NET>
wrote:
>Cornel,
>
>I'm sure that there must be an easier way, but you could use:
>
>data have;
> input old;
> cards;
>32
>12
>576
>2
>54
>;
>
>data want (keep=old new);
> set have;
> array test (3) $;
> do i=1 to length(trim(left(put(old,best12.))));
> test(i)=substr(trim(left(put(old,best12.))),i,1);
> end;
> call sortc (of test[*]);
> new=catt(of test[*]);
>run;
>
>HTH,
>Art
>--------
>On Wed, 23 Sep 2009 18:00:48 -0400, Cornel Lencar
><clencar@INTERCHANGE.UBC.CA> wrote:
>
>>Hi,
>>I have a numerical variable represented by a number that can be up to
>>three digits long. I would like to create a new variable based on the old
>>variable such that the digits are sorted in increasing (or decreasing)
>>order, such as:
>>
>>OLD_VARIABLE NEW_VARIABLE
>>32 23
>>12 12
>>576 567
>>2 2
>>54 45
>>.. ..
>>
>>Any ideas would be greately appreciated.
>>
>>Sincerely,
>>
>>Cornel Lencar
|