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

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.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
  • 2 replies
  • 649 views
  • 2 likes
  • 3 in conversation