DATA Step, Macro, Functions and more

Proc Tabulate

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Proc Tabulate

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??????

 


Accepted Solutions
Solution
‎12-10-2015 10:35 AM
Super User
Posts: 19,865

Re: Proc Tabulate

Posted in reply to KevinJChristie
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


All Replies
Solution
‎12-10-2015 10:35 AM
Super User
Posts: 19,865

Re: Proc Tabulate

Posted in reply to KevinJChristie
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?

New Contributor
Posts: 2

Re: Proc Tabulate

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

Super User
Posts: 19,865

Re: Proc Tabulate

Posted in reply to KevinJChristie
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.
🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 231 views
  • 0 likes
  • 2 in conversation