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
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.
Perhaps I'm blind, but I can't see any different methods.
Ordering of options does not impact performance, and nothing other as well.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.