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 (April 1998, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 22 Apr 1998 09:49:43 -0600
Reply-To:   Jack Hamilton <jack_hamilton@HCCOMPARE.COM>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Jack Hamilton <jack_hamilton@HCCOMPARE.COM>
Subject:   Re: Copy PROC SORT options in SQL
Comments:   To: rchild@ABTI.COM
Content-Type:   text/plain; charset=US-ASCII

Randy Childs <rchild@ABTI.COM> wrote:

>Can anyone in the group tell me if it is possible to accomplish the >same task performed by this one PROC SORT in one or two PROC SQL >statements?

Your message seems to have gone through MIME encoding somewhere along the way. Please turn it off, as it makes the message difficult to read. I changed the dataset names in your example below; I couldn't easily tell what they because they became encoded.

>PROC SORT DATA=IN OUT=OUT (KEEP = PATID STOP_SD) NODUPKEY; > BY PATID DESCENDING STOP_SD; > WHERE OUTCOME = 4; >RUN;

Untested code:

proc sql; create table out as select distinct patid, stop_sd from in where outcome=4 order patid, stop_sd desc;

In the case where the sort vars are not the same as the keep vars, neither my SQL code nor your PROC SORT code will always function as desired (see SAS Usage Note V6-SORT-B272); a combination of a sort and a data step is probably the best solution.


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