BookmarkSubscribeRSS Feed
TMSmith
Calcite | Level 5

Hi all,

 

I'm struggling to make a certain type of table I've been asked for. In essence, I need a crosstab table of all of my categorical variables so I will know cell counts. So, for example, if I had race, sex, and eye color then I will need a table of Race*sex*eyecolor by race*sex*eyecolor. So if I needed to know how many white females have green eyes I will be able to have one cell that gives the N of that specific category. I can't for the life of me figure this out. The best advice I've had so far is to use a PROC FREQ procedure, but this generates many tables for each possibility, and I need one big table.

 

 

proc freq data=mn1;
tables iedtotal_50*iedpreed_50*iededs_50*school_2*bc_1*pb_method*wm_cog_admin/ nopercent nocol norow;
run;

Could anyone help me with this? I'm sure someone out there must know how to do this. Appreciate it.

1 REPLY 1
Reeza
Super User
proc freq data=mn1;
tables iedtotal_50*iedpreed_50*iededs_50*school_2*bc_1*pb_method*wm_cog_admin/ out=want list nopercent nocol norow;
run;

 

Try that, the LIST to create a list table instead and an OUT to output a data set with the data instead of a report.

 


@TMSmith wrote:

Hi all,

 

I'm struggling to make a certain type of table I've been asked for. In essence, I need a crosstab table of all of my categorical variables so I will know cell counts. So, for example, if I had race, sex, and eye color then I will need a table of Race*sex*eyecolor by race*sex*eyecolor. So if I needed to know how many white females have green eyes I will be able to have one cell that gives the N of that specific category. I can't for the life of me figure this out. The best advice I've had so far is to use a PROC FREQ procedure, but this generates many tables for each possibility, and I need one big table.

 

 

proc freq data=mn1;
tables iedtotal_50*iedpreed_50*iededs_50*school_2*bc_1*pb_method*wm_cog_admin/ nopercent nocol norow;
run;

Could anyone help me with this? I'm sure someone out there must know how to do this. Appreciate it.



 

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
  • 1 reply
  • 619 views
  • 0 likes
  • 2 in conversation