LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: Arthur Tabachneck <art297@NETSCAPE.NET>

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


Back to: Top of message | Previous page | Main SAS-L page