06-14-2017 02:35 PM
I use proc tabulate to create a table which belows,
26 to 29
30 to 39
my code is
proc tabulate data=ttt ;
var pass first tot;
class examtitle age;
table age=" "*pass=" "*(mean="% Passing" n ), examtitle=" "*(first="First-time" tot="Total");
first is the dummy variables which if it is first time exam taker. pass is the dummy variable if passing the exam then =1, fails are 0. tot is 1 for all the observations.
but the log shows: there are multiple analysis variables associated with a single table cell inthe following nesting.
please help! Thanks!
06-14-2017 03:05 PM
Yes, you have one analysis variable used in the row definitions (PASS), and two analysis variables used in the column definitions (FIRST and TOT). You will need to limit the analysis variables to a single variable per cell, which here means they must appear either in the row definitions only or in the column definitions only.
06-14-2017 03:13 PM
table age=" "*pass=" "*(mean="% Passing" n ), <= this part of the table statement is requesting two statistics for the row: mean and N
examtitle=" "*(first="First-time" tot="Total"); <= this part of the table statement is requesting default SUM statistic for VAR variable first and Tot (any VAR not specifically assigned a request gets SUM).
So there is a conflict between what the Mean and N do when crossing the implied SUM.
You may have meant for First and Tot to be class variables if want a summary for each level of First and Tot within ExamTitle values.
It helps to provide raw input data and what the result is expected to look like. Columns in Proc Tabulate are expected to be the summary of a single variable/statistic combination. Only the CLASS variables nest. So you won't be able to have a row title %passing in the same column as the n statistic, which what your pasted result looks like.
You may need to paste from a different source as the forum main windows will reformat things and what we see may not be what you pasted.
Sometimes you have to presummarize the data before displaying the values with Proc Print/tabulate/or report.
06-14-2017 03:31 PM - edited 06-14-2017 03:40 PM
The table I showed changed when posted online. It should be like that. That is the table I want.
the data are like s
06-14-2017 04:48 PM