BookmarkSubscribeRSS Feed
KyleS83
Calcite | Level 5
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
3 REPLIES 3
Pritish
Quartz | Level 8
how about using Proc Means to get what you are trying to?

PROC MEANS NOPRINT
DATA = TEST_01;
OUTPUT MEAN=TOT_MEAN;
RUN;
KyleS83
Calcite | Level 5
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
Josh
Calcite | Level 5
After PROC MEANS merge the output dataset back to the original dataset.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1368 views
  • 0 likes
  • 3 in conversation