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
- /
- SAS Programming
- /
- Base SAS Programming
- /
- How to reuse the calculated mean value of PROC for...

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
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-19-2017 08:17 AM

I have calculated the mean of a variable using MEAN proc, now I want to use mean value for further calculation. Please help me to reuse or save the calculated mean value for further use.

```
data test;
input x ;
cards;
100
200
300
;
run;
proc means data=test;
var x;
run;
```

Accepted Solutions

Solution

04-19-2017
11:47 AM

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

Posted in reply to ervinodsingh

04-19-2017 09:33 AM

Here's two ways of accomplishing this solution.

https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset

All Replies

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

Posted in reply to ervinodsingh

04-19-2017 08:22 AM

You can output to dataset from that in a variety of ways (the manual is your friend), you could do;

proc means data=test; var x; output out=want mean=mean; run;

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

04-19-2017 11:50 AM

Thanks your solution also worked for me.

Solution

04-19-2017
11:47 AM

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

Posted in reply to ervinodsingh

04-19-2017 09:33 AM

Here's two ways of accomplishing this solution.

https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset