Hello~ Is it possible to have both frequencies and means in the same table?
Specifically, I want to show the frequencies for a 5-point scale over several waves of data, with the mean reported in the bottom row. I have not found any code that would allow both to be generated in the same table. Any help would be great appreciated!
Does this look like what you want ? Once again, this is just playing with punctuation in the TABLE statement : comma stands for separating lines and columns, space stands for contiguous information, and star stands for "within".
[pre]PROC TABULATE DATA = sashelp.class ;
CLASS sex age ;
VAR weight ;
TABLE (age*N weight*MEAN),sex ;
If the bottom row is for "age mean" in the example, you need to duplicate the age variable -- a variable cannot be CLASS and VAR at the same time.
[pre]DATA work.class ;
SET sashelp.class ;
age2 = age ;
PROC TABULATE DATA = work.class ;
CLASS sex age ;
VAR age2 ;
TABLE (age*N="" age2="Mean age"*MEAN=""),sex ;
Thanks again for your quick reply. I found it very helpful, and I am close to generating the table I want, but am still unable to incorportate percentages into the table, with a mean score in the bottom row. (I should have been clearer in my original post.)
Here's the code I'm trying to manipulate, but SAS is saying "PctN base in not in table. A PctN crossing has no denominator":
proc tabulate data=mvr.ready_08_6Jun(where=(wave ge 230)) format=9.1 noseps formchar(1,8,2,3,4,5,6,7,9,10,11)='||----|+|---';
title 'Table 1';
format wave wave. q1 sat. total total.;
class wave q1 total;
table (q1*N*f=4.0 f=p8r6.0*pctn mq1="Mean"*mean=' '),wave/rts=35
box="Table 1. OVERALL SATISFACTION" misstext=' ';;
keylabel pctn = "(%)";