Skip to content

15.7.1.3 Overriding Measurement Level ​

By default, CTABLES uses a variable’s measurement level to decide whether to treat it as categorical or scalar. Variables assigned the nominal or ordinal measurement level are treated as categorical, and scalar variables are treated as scalar.

When PSPP reads data from a file in an external format, such as a text file, variables’ measurement levels are often unknown. If CTABLES runs when a variable has an unknown measurement level, it makes an initial pass through the data to guess measurement levels using the rules described in an earlier section (see Measurement Level). Use the VARIABLE LEVEL command to set or change a variable’s measurement level (see VARIABLE LEVEL).

To treat a variable as categorical or scalar only for one use on CTABLES, add ‘[C]’ or ‘[S]’, respectively, after the variable name. The following example shows the output when variable monthDaysMin1drink is analyzed as scalar (the default for its measurement level) and as categorical:

CTABLES
    /TABLE monthDaysMin1drink BY gender
    /TABLE monthDaysMin1drink [C] BY gender.
MaleFemale
S3a. GENDER:
MaleFemale
MeanMean
20. On how many of the thirty days in this typical month did you have one or more alcoholic beverages to drink?75
S3a. GENDER:
CountCount
20. On how many of the thirty days in this typical month did you have one or more alcoholic beverages to drink?None152258
1403653
2284324
3169215
4178143
5107106
66759
73111
810174
964
109575
1140
125833
1332
14133
157958
16106
1742
1854
1920
2010547
2120
2233
2303
2430
253525
2611
2733
28138
2933
Every day10443

基于 GNU PSPP 2.0.1 手册与入门教程整理