在“ Proc制表”输出中,类标题高于类级别。有没有办法将班级标题移动到班级旁边的自己的栏中?在图像的所需输出中,“教育”的班级标题位于其自己的单元格中,靠近班级。我该怎么做?
PROC FORMAT;
PICTURE PCTF (ROUND) OTHER='009.9%';
RUN;
ODS HTML PATH="%SYSFUNC(GETOPTION(WORK) )" STYLE=JOURNAL1A;
TITLE "Question 21x";
PROC TABULATE DATA = 208s;
CLASS EDUC
AREA
AGE
SEX
CENRACE
POVERTY
EDUC
INSURE
HEALTH
Q21x;
CLASSLEV EDUC AREA AGE SEX CENRACE POVERTY EDUC INSURE HEALTH Q21x ;
TABLE AREA = 'Area in Region' * (ROWPCTN=' '*f=PCTF.)
AGE = 'Age' * (ROWPCTN=' '*f=PCTF.)
SEX * (ROWPCTN=' '*f=PCTF.)
CENRACE = 'Race' * (ROWPCTN=' '*f=PCTF.)
POVERTY = 'Poverty Status' * (ROWPCTN=' '*f=PCTF.)
EDUC * (ROWPCTN=' '*f=PCTF.)
INSURE * (ROWPCTN=' '*f=PCTF.)
HEALTH * (ROWPCTN=' '*f=PCTF.) , Q21x = ' ';
RUN;
答案 0 :(得分:0)
您可以将现有数据转换为分类形式,这将使您更好地控制行维布局。将ROWPCTN
移动到列维度中,以消除空白列(在行标题中),否则如果ROWPCTN
在行维度中会出现空白列。使用NOCELLMERGE
来防止在第一数据行中合并单元格。
例如,以
开头data have;
do personid = 1 to 1000;
area = cats('area_',0 + floor(5 * ranuni(123)));
age = cats('age_',13 + floor(7 * ranuni(123)));
sex = cats('sex_',1 + floor( 2 * ranuni(123)));
q21x = byte(65+(5*ranuni(123)));
output;
end;
label area = 'Area Label';
run;
proc tabulate data=have;
class area age sex q21x;
table
( area age sex ) * (rowpctn=' '), q21x
/ nocellmerge;
run;
以及转置后的数据版本
proc transpose data=have out=have_for_table;
by personid q21x notsorted;
var area age sex;
run;
proc tabulate data=have_for_table missing;
class _name_ _label_ col1 q21x;
table
_name_='' * _label_='' * col1=''
,
q21x * (rowpctn='')
/
nocellmerge
;
run;