BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gil_
Quartz | Level 8
I have a dataset with 3 col I would need max here is example
Id. amt. Load. Date
23. 500. 100. 01/01/2018
23. 700. 100. 02/01/2018
23. 400. 100. 03/012018
30. 450. 20. 03/20/2018
30. 650. 20. 02/01/2018
30. 300. 20. 07/29/2018

What I need as output
Id. amt. Load. Date
23. 700. 100. 02/01/2018
30. 650. 20. 02/01/2018

This is the max of amt
I used
proc sql;
Create table report1 as
Select id as id,
Max(amt) as amt,
Load,
Max(date) as day
From report2
Group by dnd;
Run;

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

proc sql;
Create table report1 as
Select *
From report2
Group by dnd

having amt=max(amt);
Run;

View solution in original post

2 REPLIES 2
Astounding
Opal | Level 21

Here's a set of tools worth learning, so you are not forced to get SQL to do this:

 

proc sort data=have;

by id amt;

run;

data want;

set have;

by id;

if last.id;

run;

 

It doesn't matter if some of this is new to you.  These are tools you will use every week ... "must learn".

Ksharp
Super User

proc sql;
Create table report1 as
Select *
From report2
Group by dnd

having amt=max(amt);
Run;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 591 views
  • 2 likes
  • 3 in conversation