|
I am trying to read in a simple text file with 5 variables.
There appears to be bug in version 11.5 when I use a macro to
define the file name in conjunction with GET DATA, but not with
DATA LIST. Examples to demonstrate this follow.
*-- Syntax 1: DATA LIST and macro to define file name works.
DEFINE !input1 ( ) '2001pop.txt' !ENDDEFINE.
DATA LIST FILE = !input1 FREE /
var1 var2 var3 var4 var5 .
DESCRIPTIVES VARS = all / STATISTICS = DEFAULT SUM.
*-- Syntax 2: GET DATA and explicit file name works.
GET DATA /TYPE = TXT
/ FILE = '2001pop.txt'
/ DELIMITERS = " "
/ VARIABLES = var1 F6 var2 F6 var3 F6 var4 F6 var5 F6.
DESCRIPTIVES VARS = all / STATISTICS = DEFAULT SUM.
*-- Syntax 3: GET DATA and macro file name fails!!.
SET MPRINT = ON.
DEFINE !input3 ( ) '2001pop.txt' !ENDDEFINE.
GET DATA /TYPE = TXT
/ FILE = !input3
/ DELIMITERS = " "
/ VARIABLES = var1 F6 var2 F6 var3 F6 var4 F6 var5 F6.
DESCRIPTIVES VARS = all / STATISTICS = DEFAULT SUM.
* === Start of output window ===.
34 M>
DEFINE !input3 ( ) '2001pop.txt' !ENDDEFINE.
35 M> DEFINE
36 M> !input3 ( ) '2001pop.txt' !ENDDEFINE.
37 M>
GET DATA /TYPE = TXT
38 M> GET DATA /TYPE = TXT
/ FILE = !input3
39 M> / FILE = '2001pop.txt'
>Error. Command name: GET DATA
>(2256) Invalid subcommand: FILE
>This command not executed.
40 M>
/ DELIMITERS = " "
/ VARIABLES = var1 F6 var2 F6 var3 F6 var4 F6 var5 F6.
42 M> / DELIMITERS = " "
>Error # 1. Command name: /
>The first word in the line is not recognized as an SPSS
command.
>This command not executed.
43 M> / VARIABLES = var1 F6 var2 F6 var3 F6 var4 F6 var5
F6.
44 M>
* === End of output window ===.
Can anyone else reproduce this on their systems? Sorry you will
need to create your own little text file.
If this a known bug? Can anyone offer some suggestions? I
gather that GET DATA is the command that is preferred to
DATA LIST these days.
Regards
Frank Milthorpe
--------------------------------------------
Frank Milthorpe
Transport Modelling Manager
Transport and Population Data Centre (TPDC)
Department of Infrastructure, Planning and Natural Resources
GPO Box 3927, Sydney NSW 2001
Level 5, 20 Lee Street, Sydney
Direct: +61 2 9762 8488
Tel: +61 2 9762 8511
Fax: +61 2 9762 8514
Email: frank.milthorpe@dipnr.nsw.gov.au
|