I would like to know how I can get this results using SAS code. I have the following dataset:
id 2015 2016 2017
1 £10 £12 £11
2 £12 £14 £13
3 £11 £20 £10
4 £10 £13 £21
5 £15 £11 £18
and I want to compute the mean as follows:
id 2015 2016 2017
1 £10 £12 £11
2 £12 £14 £13
3 £11 £20 £10
4 £10 £13 £21
5 £15 £11 £18
Mean £11.6 £14 £14.6
I thought of using proc means for do this:
proc means data=work.dataset1;
output out=work.dataout mean= /autoname;
var amt;
class id;
run;
Now, I would need to compute the difference between periods. I am having difficulties in grouping by variable and getting the mean as in the table above.
Your help will be greatly appreciated. Thanks