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
- /
- ODS and Base Reporting
- /
- Proc Tabulate or Proc Report - Geometric means

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

03-03-2008 04:01 PM

Is there a way to have the geometric mean as a summary statistic using Proc tabulate or Proc report?

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

03-04-2008 12:40 AM

Hi:

It depends on what version of SAS you're running. According to this site:

http://support.sas.com/kb/30/333.html (Frequently Asked For Statistics)

**Geometric means **

To compute the geometric mean of values in a variable, use Base SAS Sample Library program GEOMEAN. Beginning in SAS 9.1, you can compute the geometric mean of values in an observation using the Base SAS function GEOMEAN or GEOMEANZ.

Here's the site for the sample program for SAS 8:

http://support.sas.com/kb/25/366.html

Check the documentation for the GEOMEAN function explanation. The documentation path is:

Functions and CALL Routines --> GEOMEAN Function (under the category Descriptive Statistics)

Since you can only compute variables in a COMPUTE block or use functions in PROC REPORT, you would not be able to use the GEOMEAN with PROC TABULATE.

According to the doc, an example of invoking the GEOMEAN function would be some thing like:

gmn=geomean(1,2,2,4); OR

gmn=geomean(v1, v2, v3, v4); OR

gmn=geomean(of x1-x4);

Which in PROC REPORT world would be something like this:

[pre]

data mydata;

infile datalines;

input x1 x2 x3 x4;

return;

datalines;

1 2 2 4

. 2 4 8

2 2 2 2

;

run;

ods listing;

proc report data=mydata nowd;

column x1 x2 x3 x4 gmn;

define x1 / display;

define x2 / display;

define x3 /display;

define x4 / display;

define gmn / computed;

compute gmn;

gmn = geomean(of x1-x4);

endcomp;

run;

[/pre]

For more help with the GEOMEAN function, consider contacting Tech Support.

Note that the variables passed to the GEOMEAN function must be on the same row.

cynthia

It depends on what version of SAS you're running. According to this site:

http://support.sas.com/kb/30/333.html (Frequently Asked For Statistics)

To compute the geometric mean of values in a variable, use Base SAS Sample Library program GEOMEAN. Beginning in SAS 9.1, you can compute the geometric mean of values in an observation using the Base SAS function GEOMEAN or GEOMEANZ.

Here's the site for the sample program for SAS 8:

http://support.sas.com/kb/25/366.html

Check the documentation for the GEOMEAN function explanation. The documentation path is:

Functions and CALL Routines --> GEOMEAN Function (under the category Descriptive Statistics)

Since you can only compute variables in a COMPUTE block or use functions in PROC REPORT, you would not be able to use the GEOMEAN with PROC TABULATE.

According to the doc, an example of invoking the GEOMEAN function would be some thing like:

gmn=geomean(1,2,2,4); OR

gmn=geomean(v1, v2, v3, v4); OR

gmn=geomean(of x1-x4);

Which in PROC REPORT world would be something like this:

[pre]

data mydata;

infile datalines;

input x1 x2 x3 x4;

return;

datalines;

1 2 2 4

. 2 4 8

2 2 2 2

;

run;

ods listing;

proc report data=mydata nowd;

column x1 x2 x3 x4 gmn;

define x1 / display;

define x2 / display;

define x3 /display;

define x4 / display;

define gmn / computed;

compute gmn;

gmn = geomean(of x1-x4);

endcomp;

run;

[/pre]

For more help with the GEOMEAN function, consider contacting Tech Support.

Note that the variables passed to the GEOMEAN function must be on the same row.

cynthia

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

04-09-2015 08:30 AM

Hello,

How would you add descriptive statistics on the bottom of the table and to get an output like that? Is it possible with proc report?

Thank you.

- | x1 | x2 | x3 |

- | 1 | 5 | 7 |

- | 2 | 8 | 9 |

- | 3 | 10 | 4 |

- | 4 | 3 | 5 |

N | 4 | 4 | 4 |

mean | 2.5 | 6.5 | 6.25 |

std. | 1.29 | 3.11 | 2.22 |

min | 1 | 3 | 4 |

median | 2.5 | 6.5 | 6 |

max | 4 | 10 | 9 |

%CV | 51.6 | 47.8 | 35.5 |

geo. mean | 2.2 | 5.9 | 6.0 |