Desktop productivity for business analysts and programmers

How to find Max observation?

Reply
Occasional Contributor
Posts: 10

How to find Max observation?


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

Super User
Posts: 19,132

Re: How to find Max observation?

Using Query Builder

Select the two fields you want

Create a Calculated Column

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

Super Contributor
Posts: 275

Re: How to find Max observation?

data want;

    set have;

    MaxVal=max(of hrSmiley Happy;

run;Smiley Wink

Ask a Question
Discussion stats
  • 2 replies
  • 309 views
  • 0 likes
  • 3 in conversation