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 (February 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 9 Feb 2004 13:04:52 GMT
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: Returning to original sort order

Pat,

You could just create a new variable, e.g. recnum, when you initially read the file.

Art ------- data one; input ID $ Peettype $ _NAME_ $ Value; recnum=_n_; cards; 1 Comp N10 1000 1 Comp A11 1200 1 Comp F12 600 1 Comp S13 800 2 Comp N10 900 2 Comp A11 1500 2 Comp F12 980 2 Comp S13 1900 ; run; ---- "Pat Moore" <pat.moore@UAA.ALASKA.EDU> wrote in message news:200402090810.i198AxI08331@listserv.cc.uga.edu... > I have a file which is arranged in a particular order: > > ID Peettype _NAME_ Value > 1 Comp N10 1000 > 1 Comp A11 1200 > 1 Comp F12 600 > 1 Comp S13 800 > 2 Comp N10 900 > 2 Comp A11 1500 > 2 Comp F12 980 > 2 Comp S13 1900 > etc. (id is a character variable) > > I'm using proc rank to rank the values within groups: > > proc rank data=prerank9802 out=rank9802 ties=low; > by peertype _name_; > var _numeric_; > run; > > This reorganizes the file alphabetically by _name_: > 1 Comp A11 1200 1 > 1 Comp F12 600 2 > 1 Comp N10 1000 2 > 1 Comp S13 800 2 > 2 Comp A11 900 2 > 2 Comp F12 1500 1 > 2 Comp N10 1900 1 > 2 Comp S13 980 1 > > I need to keep everything together and restore the order after the ranking > step. I think an index might do it, but have never worked with one. Or, > maybe I have to create an order variable, in which case, I'm not sure how > to assign a set of sequential numbers to a series of observations. > > Confused, I am, > > Pat Moore > mailto:pmoore@uaa.alaska.edu


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