Thu 10 Sep 2009 03:13:43 PM UTC, original submission:
Looking at the input/output features of pspp, it seems that the unimplemented ADD FILES command is a major feature -that is there is no convenient 'union' command for system files.
Being new to PSPP it is not obvious how to program this feature but, perhaps the suggestion that the ADD FILES is just a special cases of the MATCH FILES may help.
ADD FILES can be replicated using MATCH FILES if each system file to be 'added' has a unique sequential ID variable - as in:
-------------------------------------------
- convert add files to match files .
add files
/file='temp1'
/file='temp2'
.
get file 'temp1'.
compute FILEID=1.
save out='temp1'.
get file 'temp2'.
compute FILEID=2.
save out='temp2'.
match file
/file='temp1'
/file='temp2'
/by=FILEID
/drop=FILEID .
list.
data list free/v1 v2.
begin data.
111 112
121 122
end data.
save out='temp1'.
data list free/v2 v3.
begin data.
212 213
222 223
end data.
save out='temp2'.
add files
/file='temp1'
/file='temp2'.
list.
OR
get file 'temp1'.
compute FILEID=1.
save out='temp1'.
get file 'temp2'.
compute FILEID=2.
save out='temp2'.
match file
/file='temp1'
/file='temp2'
/by=FILEID
/drop=FILEID .
list.
should yield ...
V1 V2 V3
111.00 112.00 .
121.00 122.00 .
. 212.00 213.00
. 222.00 223.00
-------------------------------------------
Note that if the ADD FILES has a BY clause for 'interleaving' this can be emulated by adding the FILEID to the BY list.
-------------------------------------------
Clearly it is inefficient to read and write the files with a 'FILEID' added, so, if a constant variable can be created on the fly during the read of each system file in the ADD FILES, the MATCH FILE code can be 'easily' morphed into an ADD FILES command code.
|