5daa3c1bbf645e54160dbae0f50d17bb16b6a252
[pspp] / tests / language / dictionary / variable-display.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl 
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl 
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl
17 AT_BANNER([variable display attributes])
18
19 AT_SETUP([variable display attribute commands])
20 AT_DATA([var-display.sps], [dnl
21 DATA LIST FREE /x y z.
22 VARIABLE ALIGNMENT x (LEFT)/y (RIGHT)/z (CENTER).
23 VARIABLE WIDTH x (10)/y (12)/z (14).
24 VARIABLE LEVEL x (SCALE)/y (ORDINAL)/z (NOMINAL).
25 VARIABLE ROLE /TARGET x /BOTH y /NONE z.
26 DISPLAY DICTIONARY.
27 ])
28 AT_CHECK([pspp -o pspp.csv var-display.sps])
29 AT_CHECK([cat pspp.csv], [0], [dnl
30 Table: Variables
31 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
32 x,1,,Scale,Output,10,Left,F8.2,F8.2,
33 y,2,,Ordinal,Both,12,Right,F8.2,F8.2,
34 z,3,,Nominal,None,14,Center,F8.2,F8.2,
35 ])
36 AT_CLEANUP
37
38
39 AT_BANNER([VARIABLE LABELS])
40
41 AT_SETUP([variable labels])
42
43 dnl The following test is to make sure the TVARS command works and that
44 dnl variables are displayed accordingly.
45 AT_DATA([var-labels.sps], [dnl
46 DATA LIST LIST NOTABLE /x * y *.
47 BEGIN DATA.
48 1 100
49 2 200
50 3 300
51 4 400
52 END DATA.
53
54 * While no labels have been set, the TVARS is irrelevant.
55 SET TVARS=NAMES.
56 DESCRIPTIVES ALL.
57
58 SET TVARS=LABELS.
59 DESCRIPTIVES ALL.
60
61 SET TVARS=BOTH.
62 DESCRIPTIVES ALL.
63
64 VARIABLE LABEL x 'foo' y 'bar'.
65
66 * Now, the TVARS setting should have effect
67
68 SET TVARS=NAMES.
69 DESCRIPTIVES ALL.
70
71 SET TVARS=LABELS.
72 DESCRIPTIVES ALL.
73
74 SET TVARS=BOTH.
75 DESCRIPTIVES ALL.
76 ])
77
78 AT_CHECK([pspp -O format=csv var-labels.sps], [0],[dnl
79 Table: Valid cases = 4; cases with missing value(s) = 0.
80 Variable,N,Mean,Std Dev,Minimum,Maximum
81 x,4,2.50,1.29,1.00,4.00
82 y,4,250.00,129.10,100.00,400.00
83
84 Table: Valid cases = 4; cases with missing value(s) = 0.
85 Variable,N,Mean,Std Dev,Minimum,Maximum
86 x,4,2.50,1.29,1.00,4.00
87 y,4,250.00,129.10,100.00,400.00
88
89 Table: Valid cases = 4; cases with missing value(s) = 0.
90 Variable,N,Mean,Std Dev,Minimum,Maximum
91 x,4,2.50,1.29,1.00,4.00
92 y,4,250.00,129.10,100.00,400.00
93
94 Table: Valid cases = 4; cases with missing value(s) = 0.
95 Variable,N,Mean,Std Dev,Minimum,Maximum
96 x,4,2.50,1.29,1.00,4.00
97 y,4,250.00,129.10,100.00,400.00
98
99 Table: Valid cases = 4; cases with missing value(s) = 0.
100 Variable,N,Mean,Std Dev,Minimum,Maximum
101 foo,4,2.50,1.29,1.00,4.00
102 bar,4,250.00,129.10,100.00,400.00
103
104 Table: Valid cases = 4; cases with missing value(s) = 0.
105 Variable,N,Mean,Std Dev,Minimum,Maximum
106 foo (x),4,2.50,1.29,1.00,4.00
107 bar (y),4,250.00,129.10,100.00,400.00
108 ])
109
110 AT_CLEANUP