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

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
4 REPLIES 4
DavidPhillips2
Rhodochrosite | Level 12

Thanks that is exactly what I want.

DavidPhillips2
Rhodochrosite | Level 12

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

GENDERCOUNTPERCENTWholePercent of whole
Fall 2010Female20990.587462.931080.200424
Fall 2011Female21670.575412.931080.196313
Fall 2012Female20750.582542.931080.198746
Fall 2013Female20910.589842.931080.201236
Fall 2014Female21170.595832.931080.20328
Fall 2010Male14550.407222.061340.197551
Fall 2011Male15980.424322.061340.205847
Fall 2012Male14860.417182.061340.202383
Fall 2013Male14490.408742.061340.198288
Fall 2014Male14350.403882.061340.195931
Fall 2010Not Reported190.005320.007560.703704
Fall 2011Not Reported10.000270.007560.035714
Fall 2012Not Reported10.000280.007560.037037
Fall 2013Not Reported50.001410.007560.186508
Fall 2014Not Reported10.000280.007560.037037
DavidPhillips2
Rhodochrosite | Level 12

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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