The SAS Output Delivery System and reporting techniques

remove repeated data and retain the maximum value

Reply
N/A
Posts: 0

remove repeated data and retain the maximum value

Hi,

Do you know the script or procedure in JMP on how to remove the repeated items and still retain the row with maximum data. ie

Raw Data
Company Job Salary
ABC D 50
ABC D 60
DEF F 70
DEF G 80

Desired Output
Company Job Salary
ABC D 60
DEF G 80

Thanks,
Phil
Super Contributor
Super Contributor
Posts: 3,174

Re: remove repeated data and retain the maximum value

Here's one SAS programming approach using only SORT to generate the result you showed:

data ;
input Company $ Job $ Salary ;
datalines;
ABC D 50
ABC D 60
DEF F 70
DEF G 80
run;
proc sort ;
by company descending salary;
run;
proc sort nodupkey equals ;
by company ;
run;
options nocenter;
proc print u noobs;
run;

Scott Barry
SBBWorks, Inc.
Contributor
Posts: 25

Re: remove repeated data and retain the maximum value

Hi Scott,

Good Answer.
I've a small Question.
Actually in Proc Sort what is the functionality of "Equals","Noequals".
In which conditions we need to use those options?

Thanks,
Alankar
SAS Super FREQ
Posts: 8,744

Re: remove repeated data and retain the maximum value

Hi:
The documentation talks about it in great detail:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000146878.htm

in short:
EQUALS: Maintain relative order within BY groups
NOEQUALS: Do not maintain relative order within BY groups

cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 123 views
  • 0 likes
  • 4 in conversation