BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Mirisage
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

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

3 REPLIES 3
LinusH
Tourmaline | Level 20

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
SASKiwi
PROC Star

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.

Mirisage
Obsidian | Level 7

Hi SASKiwi and

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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