🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 02-05-2019 03:19 PM
(3726 views)
Hello,
Can anyone help me with the following?
I have the following data set and I'm trying to get the average by Id for the entire year.
dataset:
date | id | amount |
jan | a1 | 10 |
jan | a2 | 4 |
jan | a3 | 2 |
feb | a1 | 6 |
feb | a2 | 4 |
feb | a3 | 8 |
march | a1 | 6 |
march | a2 | 5 |
march | a3 | 1 |
what I'm trying to get:
id | average |
a1 | 7.3 |
a2 | 4.3 |
a3 | 3.6 |
Thanks!
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sql;
create table want as
select id, avg(amount) as average
from have
group by id;
quit;
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PROC MEANS/PROC SUMMARY
Example:
--
Paige Miller
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sql;
create table want as
select id, avg(amount) as average
from have
group by id;
quit;