Programming the statistical procedures from SAS

New to SAS, need help with calculating average

Reply
Occasional Contributor
Posts: 9

New to SAS, need help with calculating average

Hi,

I'm learning base SAS programming at the moment. This is part of my SAS data set that shows the average return of stocks after a 9 year period from 20 different companies. I want to calculate the average of this variable (average of the AvgReturn). I tried doing mean(AvgReturn) but it doesn't work. I prefer not to input all the numbers so how would I go about this?

Thanks!



AvgReturn

11.24
5.45
11.57
-1.69
17.79
11.03
6.61
1.88
1.49
14.15
29.47
0.03
9.73
19.66
4.11
12.51
6.84
7.62
-0.64
0.63
Contributor
Posts: 65

Re: New to SAS, need help with calculating average

how about using Proc Means to get what you are trying to?

PROC MEANS NOPRINT
DATA = TEST_01;
OUTPUT MEAN=TOT_MEAN;
RUN;
Occasional Contributor
Posts: 9

Re: New to SAS, need help with calculating average

The average has to be calculated Data Step, because after I calculate the average of the variable AvgReturn I have to compare the results to it
Occasional Contributor
Posts: 11

Re: New to SAS, need help with calculating average

After PROC MEANS merge the output dataset back to the original dataset.
Ask a Question
Discussion stats
  • 3 replies
  • 148 views
  • 0 likes
  • 3 in conversation