DATA Step, Macro, Functions and more

Difference between NOdup and NoDupkey..??

Reply
New Contributor
Posts: 2

Difference between NOdup and NoDupkey..??

hi,

 

I am havig the following dataset

Customer Month      Type    Amount

A1        03JAN2004 PETRO 2000

A1        03JAN2004 PETRO 2000

A1        12JAN2004 JEWELLWERY 1000

A1        12JAN2004 JEWELLWERY 1000

 

Iam not getting the code for taking the duplicate values out in a separate dataset. Iam using this code

 

Proc sort data=valid_cards1 nodupkey nodopout=duplicates;
by customer month type amount;
run;

 

 Can anybody help?

 

Thanks & Regards

Mona

 


Capture.PNG
PROC Star
Posts: 551

Re: Difference between NOdup and NoDupkey..??

[ Edited ]

NODUPKEY option: Deletes observations with duplicate BY values

 

DUPOUT= option: Specifies the output data set to which duplicate observations are written.

 

I think your code has some misspelling and should be as this:

 

data valid_cards1;
input Customer$ Month:date9. Type$ Amount;
format Month date9.;
datalines;
A1 03JAN2004 PETRO 2000
A1 03JAN2004 PETRO 2000
A1 12JAN2004 JEWELLWERY 1000
A1 12JAN2004 JEWELLWERY 1000
;

Proc sort data=valid_cards1 nodupkey dupout=duplicates;
by customer month type amount;
run;

See the available options in the documentation here

 

https://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000146878.htm 

Ask a Question
Discussion stats
  • 1 reply
  • 417 views
  • 2 likes
  • 2 in conversation