How can I make a table like this?

Accepted Solution Solved
Reply
Contributor
Posts: 37
Accepted Solution

How can I make a table like this?

[ Edited ]

I'm tryng to make a table that looks like this:

 

EducationSex
Frequency
Col Pct
FEMALEMALETotal
 N%N%N%
No formal schooling0042.314155
Grade 8 or less0095.293.49
Some high school55.883117.923613.95
High school graduate1214.124324.865521.32
Some trade school/technical, college or university17203117.924818.6
Trade school/technical training program graduate67.062413.873011.63
Community college graduate2428.241810.44216.28
University Graduate2124.71137.513413.18
Total85100%173100258100

 

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


Accepted Solutions
Solution
‎12-13-2016 10:59 AM
Super User
Posts: 10,543

Re: How can I make a table like this?

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.

 

View solution in original post


All Replies
Solution
‎12-13-2016 10:59 AM
Super User
Posts: 10,543

Re: How can I make a table like this?

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.

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 140 views
  • 1 like
  • 2 in conversation