Help using Base SAS procedures

proc sort nodupkey question?

Accepted Solution Solved
Reply
Super Contributor
Posts: 338
Accepted Solution

proc sort nodupkey question?

Hi SAS Forum,

To show my proc sort question, I have taken the below data set from SUGI paper 037-30 of Britta Kelsey, and is acknowledged.

data best;

input patient 1-2 arm $ 4-5 bestres $ 6-7 delay 9-10;

datalines;

01 A CR 0

02 A PD 1

03 B PR 1

04 B CR 2

05 C SD 1

06 C SD 3

07 C PD 2

01 A CR 0

03 B PD 1

;

run;

I have seen in many papers nodupkey in proc sort is used like in mtheod 1 below but my boss is always using it

like in method 2.

I have checked using proc compare and found that identical resutls are produced by both methods.

Method 1:

proc sort data=best  nodupkey out=ex1;

by arm patient;

run;

Method 2:

proc sort data=best out=ex2 nodupkey;

by arm patient;

run;

proc compare base=ex1 compare=ex2; run;

Question:

1. Do both methods produce identical results for larger data sets too?

2. Which method is efficient?

Could some one help me.

Thanks

Mirisa


Accepted Solutions
Solution
‎03-27-2014 06:56 PM
Super User
Posts: 3,105

Re: proc sort nodupkey question?

NODUPKEY is an option on the PROC SORT statement. The placement of it is simply a matter of coding style and this doesn't change what it does or affect processing efficiency at all.

As long as NODUPKEY is placed after PROC SORT it can go in any order with the DATA = and OUT = options.

View solution in original post


All Replies
Super User
Posts: 5,256

Re: proc sort nodupkey question?

Perhaps I'm blind, but I can't see any different methods.

Ordering of options does not impact performance, and nothing other as well.

Data never sleeps
Solution
‎03-27-2014 06:56 PM
Super User
Posts: 3,105

Re: proc sort nodupkey question?

NODUPKEY is an option on the PROC SORT statement. The placement of it is simply a matter of coding style and this doesn't change what it does or affect processing efficiency at all.

As long as NODUPKEY is placed after PROC SORT it can go in any order with the DATA = and OUT = options.

Super Contributor
Posts: 338

Re: proc sort nodupkey question?

Hi SASKiwi and

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 234 views
  • 3 likes
  • 3 in conversation