BookmarkSubscribeRSS Feed
wil1212
Calcite | Level 5


Hello,

I would like help finding the max value for each meter. My data is below.

Meter     date            hr1     hr2     hr3     hr4     hr5

123        1/1/2015      2        15      6        7        13

234        1/1/2015      40       10      3       1        0

345        1/1/2015      12       15     6       24      12

456        1/1/2015      2        18      5        6        11

567        1/1/2015      2        10      33       1        21

And I want it to look like...

Meter     date           MaxVal

123        1/1/2015      15

234        1/1/2015      40     

345        1/1/2015     24     

456        1/1/2015     18     

567        1/1/2015     33

2 REPLIES 2
Reeza
Super User

Using Query Builder

Select the two fields you want

Create a Calculated Column

Define it as  Max(hr1, hr2, hr3, hr4, hr5)

slchen
Lapis Lazuli | Level 10

data want;

    set have;

    MaxVal=max(of hr:);

run;Smiley Wink

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 834 views
  • 0 likes
  • 3 in conversation