I'm tryng to make a table that looks like this:
Education | Sex | |||||
Frequency Col Pct | FEMALE | MALE | Total | |||
N | % | N | % | N | % | |
No formal schooling | 0 | 0 | 4 | 2.31 | 4 | 155 |
Grade 8 or less | 0 | 0 | 9 | 5.2 | 9 | 3.49 |
Some high school | 5 | 5.88 | 31 | 17.92 | 36 | 13.95 |
High school graduate | 12 | 14.12 | 43 | 24.86 | 55 | 21.32 |
Some trade school/technical, college or university | 17 | 20 | 31 | 17.92 | 48 | 18.6 |
Trade school/technical training program graduate | 6 | 7.06 | 24 | 13.87 | 30 | 11.63 |
Community college graduate | 24 | 28.24 | 18 | 10.4 | 42 | 16.28 |
University Graduate | 21 | 24.71 | 13 | 7.51 | 34 | 13.18 |
Total | 85 | 100% | 173 | 100 | 258 | 100 |
But I can't seem to actually get it to look like this. I've been able to get the data I need by using this code:
proc freq data=demo_combined_final; tables program*ca_education*gender/norow; format ca_education education.; label gender='Gender' ca_education='Education' program='Program'; run;
But it's time consuming to have to reformat everything.
Does anyone know if it's possible to make a table like the above?
the female and male headings should go across the "N" and the "%" headings in the first 4 columns
You don't show how program fits but this may get you started with a different report procedure:
proc tabulate data=demo_combined_final; class ca_education gender; tables ca_education All='Total', (gender All='Total') *(n colpctn) ; format ca_education education.; label gender='Gender' ca_education='Education' program='Program'; run;
Procs Report and Tabulate come into play when you need more than Freq provides. They will also do statistics such as Proc means such as max, min, mean, standard deviation and others.
You don't show how program fits but this may get you started with a different report procedure:
proc tabulate data=demo_combined_final; class ca_education gender; tables ca_education All='Total', (gender All='Total') *(n colpctn) ; format ca_education education.; label gender='Gender' ca_education='Education' program='Program'; run;
Procs Report and Tabulate come into play when you need more than Freq provides. They will also do statistics such as Proc means such as max, min, mean, standard deviation and others.
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.
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.