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

Hello all, I'm having trouble with proc tabulate.  I need a table that shows mean SEED, TIME, and SPLIT TIME 1 for each STATE by GENDER group, But I also need it to show the number of particpants in each state by gender group. I have the following code:

 

proc tabulate data = q10;
format gender sex_fmt.;
class state gender;
var seed time split1 ;
tables (seed time split1)*mean,state*gender;
run;

 

The format simply takes gender from being 0's and 1's to Male and Female.  That code works just fine and produces a table that meets the first few requirements, but my problem comes in when I try to show the number of participants in each state by gender category.  I've added *n everywhere I can think of and I still get the same error:

 

There are multiple statistics associated with a single table cell in the following nesting :
Split1 * Mean * Gender * N * State.

 

 This is the code that generated that error:

proc tabulate data = q10;
format gender sex_fmt.;
class state gender;
var seed time split1 ;
tables (seed time split1)*mean,state*gender*n;
run;

 

No matter how I arrange the variables it always tells me that I have overlapping data in cells.  What am I missing??????

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
proc tabulate data = q10;
format gender sex_fmt.;
class state gender;
var seed time split1 ;
tables (seed time split1)*(mean N),state*gender;
run;

Does that get you any closer?

View solution in original post

3 REPLIES 3
Reeza
Super User
proc tabulate data = q10;
format gender sex_fmt.;
class state gender;
var seed time split1 ;
tables (seed time split1)*(mean N),state*gender;
run;

Does that get you any closer?

KevinJChristie
Fluorite | Level 6

That works! Its not pretty but it works! thank you.

Reeza
Super User
Yeah, without sample data and a clearer picture of what your table should look like it's harder to help. One little cheat that I do, is use SAS EG for building tables and then steal the proc tabulate code.

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
  • 3 replies
  • 870 views
  • 0 likes
  • 2 in conversation