🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Rhodochrosite | Level 12

## Proc means to find the average based on a character column

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Proc means to find the average based on a character column

Use Proc Freq instead.

4 REPLIES 4
Super User

## Re: Proc means to find the average based on a character column

Use Proc Freq instead.

Rhodochrosite | Level 12

## Re: Proc means to find the average based on a character column

Thanks that is exactly what I want.

Rhodochrosite | Level 12

## Re: Proc means to find the average based on a character column

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
Rhodochrosite | Level 12

## Re: Proc means to find the average based on a character column

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.

Discussion stats
• 4 replies
• 1597 views
• 0 likes
• 2 in conversation