good night:
i have this table:
data have;
input Animal age weight;
cards;
1 | 11 | 10 |
1 | 21 | 10.2 |
1 | 31 | 10.21 |
1 | 41 | 10.22 |
1 | 45 | 10.45 |
1 | 50 | 10.6 |
2 | 43 | 11 |
2 | 45 | 11.3 |
2 | 49 | 11.35 |
2 | 60 | 11.3 |
2 | 65 | 12.2 |
2 | 70 | 12.5 |
2 | 76 | 12.65 |
2 | 80 | 13 |
2 | 95 | 14 |
2 | 105 | 16 |
3 | 25 | 10 |
;
and i need to obtain the mean of the observations, please note that the animal number 3 is alone, so i need to use this exac value to create a table like this:
Animal | Weight_Avegare |
1 | 10.28 |
2 | 12.53 |
3 | 10.00 |
Thank you very much
Here is a solution:
data have;
input Animal age weight;
cards;
1 11 10
1 21 10.2
1 31 10.21
1 41 10.22
1 45 10.45
1 50 10.6
2 43 11
2 45 11.3
2 49 11.35
2 60 11.3
2 65 12.2
2 70 12.5
2 76 12.65
2 80 13
2 95 14
2 105 16
3 25 10
;
proc sql;
create table want as
select animal,avg(weight) as Weight_Average
from have
group by animal;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.