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
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
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
I don't understand any of that, sorry.

View solution in original post

8 REPLIES 8
Reeza
Super User

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.

Gil_
Quartz | Level 8
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
Reeza
Super User
I don't understand any of that, sorry.
Gil_
Quartz | Level 8
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
Reeza
Super User

Sorry, that's still unclear. 

Gil_
Quartz | Level 8
 
Gil_
Quartz | Level 8
I just need the 3rd entry where the total ewuals 140
Gil_
Quartz | Level 8
Its ok reeza thanks gor help i fig it out whst a relief

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
  • 8 replies
  • 1238 views
  • 0 likes
  • 2 in conversation