Automatically infer variables' measurement level from format and data.
[pspp] / tests / language / dictionary / apply.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2019 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([APPLY DICTIONARY])
18
19 AT_SETUP([APPLY DICTIONARY])
20 AT_DATA([apply-dict.sps], [dnl
21 data list notable list /foo (TIME22.0) bar (a22).
22 begin data
23 end data.
24 Variable label foo "This is a label".
25 save outfile='ugg.sav'.
26
27 new file.
28 data list notable list /foo bar *.
29 begin data
30 end data.
31 display dictionary.
32 apply dictionary from = 'ugg.sav'.
33 display dictionary.
34 ])
35
36 AT_CHECK([pspp -O format=csv apply-dict.sps], [0],  [dnl
37 Table: Variables
38 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
39 foo,1,Nominal,Input,8,Right,F8.2,F8.2
40 bar,2,Nominal,Input,8,Right,F8.2,F8.2
41
42 "apply-dict.sps:12: warning: APPLY DICTIONARY: Variable bar is numeric in target file, but string in source file."
43
44 Table: Variables
45 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format
46 foo,1,This is a label,Nominal,Input,8,Right,TIME22.0,TIME22.0
47 bar,2,,Nominal,Input,8,Right,F8.2,F8.2
48 ])
49
50 AT_CLEANUP