我有以下示例数据:
DATA offenders;
INPUT id :$12. age :3. sex :$1. residenceStatus :$1.;
INFORMAT id $12.;
INFILE DATALINES DSD;
DATALINES;
1,30,m,A
2,20,f,B
3,16,u,X
4,55,m,X
5,60,f,Y
6,20,f,A
7,34,m,B
8,63,m,X
9,23,m,X
10,19,f,A
11,56,f,A
12,25,u,X
13,31,u,A
14,24,f,B
15,27,m,A
16,20,m,B
17,21,u,A
18,43,f,A
19,44,u,A
20,41,m,B
;
RUN;
proc format;
value agegrp 1-20 = '1-20'
21-30 = '21-30'
31-40 = '31-40'
41-50 = '41-50'
51-60 = '51-60'
61-70 = '61-70';
value $status 'A' = 'Status A'
'B' = 'Status B'
'X' = 'Status X'
'Y' = 'Status Y';
run;
现在,我正在使用 PROC TABULATE 创建一个交叉表:
proc tabulate;
class age sex residenceStatus;
table sex="", (ALL residenceStatus="") * age="" /misstext="0";
format age agegrp. residenceStatus $status.;
run;
但是如何更改交叉表中特定变量的顺序?
例如,在上面的示例中,列是:
ALL Status A Status B Status X Status Y
1-20 21-30 ... 1-20 21-30 ... 1-20 21-30 ... 1-20 21-30 ... 1-20 21-30 ...
f
m
u
如果我想要ALL Status X Status B Status A Status Y
呢?谢谢你的帮助!