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
- /
- BI
- /
- Stored Processes
- /
- Proc means to find the average based on a characte...

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

08-07-2015 04:06 PM

Is there a way to use proc means to find the average based on a character column? Lets say I have a column that has two values male and female. I want to know the percent of men and the percent of women. Then do the same over a period of years.

Accepted Solutions

Solution

08-07-2015
04:08 PM

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

Posted in reply to DavidPhillips2

08-07-2015 04:08 PM

Use Proc Freq instead.

All Replies

Solution

08-07-2015
04:08 PM

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

Posted in reply to DavidPhillips2

08-07-2015 04:08 PM

Use Proc Freq instead.

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

Posted in reply to Reeza

08-07-2015 05:13 PM

Thanks that is exactly what I want.

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

Posted in reply to DavidPhillips2

08-10-2015 09:38 AM

Is there a way to use proc freq to compute percentages on two columns? I’m trying to calculate the percent of whole based on gender and the percent of whole based on year. Note the second percent of whole would not be a sub percent of the first category. I could run two separate freq statements and merge then together, but I’m worried about processing speed. My desired output would look like.

ACADEMIC_PERIOD_DESC | GENDER | COUNT | PERCENT | Whole | Percent of whole |

Fall 2010 | Female | 2099 | 0.58746 | 2.93108 | 0.200424 |

Fall 2011 | Female | 2167 | 0.57541 | 2.93108 | 0.196313 |

Fall 2012 | Female | 2075 | 0.58254 | 2.93108 | 0.198746 |

Fall 2013 | Female | 2091 | 0.58984 | 2.93108 | 0.201236 |

Fall 2014 | Female | 2117 | 0.59583 | 2.93108 | 0.20328 |

Fall 2010 | Male | 1455 | 0.40722 | 2.06134 | 0.197551 |

Fall 2011 | Male | 1598 | 0.42432 | 2.06134 | 0.205847 |

Fall 2012 | Male | 1486 | 0.41718 | 2.06134 | 0.202383 |

Fall 2013 | Male | 1449 | 0.40874 | 2.06134 | 0.198288 |

Fall 2014 | Male | 1435 | 0.40388 | 2.06134 | 0.195931 |

Fall 2010 | Not Reported | 19 | 0.00532 | 0.00756 | 0.703704 |

Fall 2011 | Not Reported | 1 | 0.00027 | 0.00756 | 0.035714 |

Fall 2012 | Not Reported | 1 | 0.00028 | 0.00756 | 0.037037 |

Fall 2013 | Not Reported | 5 | 0.00141 | 0.00756 | 0.186508 |

Fall 2014 | Not Reported | 1 | 0.00028 | 0.00756 | 0.037037 |

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

Posted in reply to DavidPhillips2

08-10-2015 10:10 AM

I was hoping this table in

Request | Equivalent to |
---|---|

tables A*(B C); | tables A*B A*C; |

tables (A B)*(C D); | tables A*C B*C A*D B*D; |

tables (A B C)*D; | tables A*D B*D C*D; |

tables A – – C; | tables A B C; |

tables (A – – C)*D; | tables A*D B*D C*D; |

Base SAS(R) 9.2 Procedures Guide: Statistical Procedures, Third Edition

would help but I can't seem to figure out how to use the table statement to produce the desired result.