Date: Tue, 17 Dec 2002 11:05:37 +0800
Reply-To: =?gb2312?q?Johnson=20Chang?= <jchangmail@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: =?gb2312?q?Johnson=20Chang?= <jchangmail@YAHOO.COM>
Subject: Re: Sorting by a formatted value
In-Reply-To: <3DF766D0.8D3EF844@yorku.ca>
Content-Type: text/plain; charset=gb2312
Like this,
proc sql;
create table table2
select *
from table1
order by put(Skin_Colour, $skinord.);
HTH,
J Chang
--- Michael Friendly <friendly@YORKU.CA> 的正文:> I'm creating tables with character
variables I need to arrange
> in a particular non-alphabetic order.
>
> I can do this in several steps,
>
> proc format;
> value $skinord 'White'='1' 'Brown'='2' 'Black'='4' 'Other'='3';
>
> data table1;
> set table1;
> skinorder = put(Skin_Colour, $skinord.);
> run;
> proc sort data=table1;
> by skinorder ;
>
>
> But I'm wondering if there is a simpler way, perhaps with
> PROC SQL.
>
> -michael
> --
> Michael Friendly friendly@yorku.ca
> York University http://www.math.yorku.ca/SCS/friendly.html
> Psychology Department
> 4700 Keele Street Tel: (416) 736-5115 x66249
> Toronto, Ontario, M3J 1P3 Fax: (416) 736-5814
_________________________________________________________
Do You Yahoo!?
"您想享受2-7折星级酒店价格吗?"
http://cn.travel.yahoo.com/
|