turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- New to SAS, need help with calculating average

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-21-2011 11:46 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-21-2011 12:30 PM

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

PROC MEANS NOPRINT

DATA = TEST_01;

OUTPUT MEAN=TOT_MEAN;

RUN;

PROC MEANS NOPRINT

DATA = TEST_01;

OUTPUT MEAN=TOT_MEAN;

RUN;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-21-2011 12:34 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-21-2011 06:36 PM

After PROC MEANS merge the output dataset back to the original dataset.