Help using Base SAS procedures

Max values not working

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 114
Accepted Solution

Max values not working

Hi i have a table that sums 7 differ denominations into a total i need to group it by only the max values
Proc sql;
Create table table1 as
(Select
Id,
Date,
Type,
1 amt,
2 amt,
5 amt
10 amt,
20 amt,
50 smt
100 amt
Max (1 amt,2amt,5amt,10amt,20amt,50amt,100amt) as max
Ftom data
Group by type);
Run;

It should sum all tge denom than get tge max by type

Accepted Solutions
Solution
‎10-17-2017 07:16 PM
Super User
Posts: 23,705

Re: Max values not working

I don't understand any of that, sorry.

View solution in original post


All Replies
Super User
Posts: 23,705

Re: Max values not working

MAX() in PROC SQL works in two ways. 

 

If you have multiple variables, it operates row wise and takes the max of the variables listed for each row. 

If you have a single variable, it takes the maximum of that column.

Frequent Contributor
Posts: 114

Re: Max values not working

I have mulitple variables so i did a max like my example above... my output

Id. A1.
date 10/12/13
type. Plus
1 amt 0
2 amt 0
5 amt 0
10 amt 10
20 amt. 15
50 amt 0
100 amt 0
total 35
Id a1
date 10/12/13
type. Plus
1 amt 0
2 amt 0
5 amt 0
10 amt 30
20 amt. 40
50 amt 0
100 amt 0
total 70


I need the table that eq 70 tge data is horizontal to fit
Solution
‎10-17-2017 07:16 PM
Super User
Posts: 23,705

Re: Max values not working

I don't understand any of that, sorry.
Frequent Contributor
Posts: 114

Re: Max values not working

Sorry reeza
My out put
Id. Date. Tyoe 20 amt 50amt 100 ant. Total
A1. 10/12/17. Pull. 10. 30. 40. 80
a1. 10/12/17. Pull. 20. 20. 20. 60
A1. 20/12/17. Pull. 30. 50. 60. 140

1st 2 entries are entry 3rd it sum botg i need fhe 3td optoon
Super User
Posts: 23,705

Re: Max values not working

Sorry, that's still unclear. 

Frequent Contributor
Posts: 114

Re: Max values not working

 
Frequent Contributor
Posts: 114

Re: Max values not working

I just need the 3rd entry where the total ewuals 140
Frequent Contributor
Posts: 114

Re: Max values not working

Its ok reeza thanks gor help i fig it out whst a relief
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 299 views
  • 0 likes
  • 2 in conversation