Date: Tue, 8 May 2012 15:10:00 -0500
Reply-To: "Peterson, Stephanie M. [RO HCPR]" <Peterson.Stephanie2@MAYO.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Peterson, Stephanie M. [RO HCPR]" <Peterson.Stephanie2@MAYO.EDU>
Subject: Re: sorting
In-Reply-To: <CAM+YpE8kx0hm+-U-h=soyZqojD8CBXgWpTCSWp_rJH8hp15j9Q@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
Thanks I can never remember those
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Joe
Matise
Sent: Tuesday, May 08, 2012 3:09 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: sorting
Don't forget the options on compress:
compress(datavar,,'kd') -> keeps only digits
compress(datavar,,'ka') -> keeps only alpha chars
-Joe
On Tue, May 8, 2012 at 3:07 PM, bbser 2009 <bbser2009@gmail.com> wrote:
> Super cool!
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Peterson, Stephanie M. [RO HCPR]
> Sent: May-08-12 3:47 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: [SAS-L] sorting
>
> cool
>
>
>
> From: Joe Matise [mailto:snoopy369@gmail.com]
> Sent: Tuesday, May 08, 2012 2:46 PM
> To: Peterson, Stephanie M. [RO HCPR]
> Cc: SAS-L@listserv.uga.edu
> Subject: Re: sorting
>
>
>
> This seems to work properly:
>
>
>
> data test;
>
> input testdata $;
>
> datalines;
>
> 1
>
> 1A
>
> 1B
>
> 15
>
> 16A
>
> 18D
>
> 18F
>
> 2A
>
> 2C
>
> 15D
>
> 3A
>
> 3C
>
> 8
>
> 4B
>
> 23A
>
> 7F
>
> 16G
>
> ;;;;
>
> run;
>
>
>
> proc sort data=test sortseq=linguistic(numeric_collation=on);
>
> by testdata;
>
> run;
>
>
>
> -Joe
>
>
>
> On Tue, May 8, 2012 at 2:25 PM, Peterson, Stephanie M. [RO HCPR]
> <Peterson.Stephanie2@mayo.edu> wrote:
>
> That almost works, except it still does:
>
>
>
> 1
>
> 10
>
> 10A
>
> 11
>
> 12
>
> 13
>
> .....
>
> 19
>
> 19A
>
> 2
>
> 20
>
> 20A
>
>
>
> Etc
>
>
>
> Thanks!
>
>
>
> I have them divided up so I'm okay for now!
>
>
>
> From: Joe Matise [mailto:snoopy369@gmail.com]
> Sent: Tuesday, May 08, 2012 2:21 PM
> To: Peterson, Stephanie M. [RO HCPR]
> Cc: SAS-L@listserv.uga.edu
> Subject: Re: sorting
>
>
>
> How do you want them sorted? 16O before 8J or after?
>
>
>
> The only way I know to deal with this sort of situation is to use
> SORTSEQ options. The following paper explains how they work, although
> nothing specifically addressing your issue; you might try
> SORTSEQ=LINGUISTIC with numeric collation and see where that gets you,
> or look in the documentation for more info.
>
>
>
> -Joe
>
> On Tue, May 8, 2012 at 1:48 PM, Peterson, Stephanie M. [RO HCPR]
> <Peterson.Stephanie2@mayo.edu> wrote:
>
> Is there a way to easily sort test numbers that are 1,1A,1B,....16M,
> 16O, 8J, etc...
>
>
>
> I know I can split it up and then sort the numbers and letters and
> sort by both but I was wondering if there was an easier way..
>
>
>
>
>
> Stephanie Peterson | Health Care Policy & Research | Statistical
> Analyst Programmer | 507-284-8280 | peterson.stephanie2@mayo.edu Mayo
> Clinic | 200 First Street SW | Rochester, MN 55905 | mayoclinic.org
> <http://www.mayoclinic.org/>
>
|