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

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

1 REPLY 1
ballardw
Super User

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.

 

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
  • 1 reply
  • 323 views
  • 1 like
  • 2 in conversation