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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1623 views
  • 0 likes
  • 2 in conversation