Formatting supported by the get data / data list commands

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Formatting supported by the get data / data list commands

Pascal Heus
Hi:
I'm trying to import data from a fixed ASCII file using the GET FILE
command with the variable formats defined inline. The SPSS documentation
indicates the the syntax should be as follows:
...
VARIABLES subcommand for ARRANGEMENT = FIXED
  /VARIABLES [/rec#] varname startcol-endcol format

This works fine with common numeric formats or dates but when I try to
use less conventional formats like scientific notation (E16.2) or
date/time (DateTime17.0) I get an error message:
 >Error.  Command name: GET DATA
 >(2265) Unrecognized or invalid variable definition.
 >This command not executed.

Is there a limitation in the format specifications for the GET DATA and
DATA LIST commands? Is there a way around this? I know these ASCII files
contain the correct formatting as they were originally exported from
SPSS. How can I specify this on import? This is for a data conversion
utility application so it needs to work all common versions of SPSS (I'm
testing with 11).

many thanks
Pascal

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Formatting supported by the get data / data list commands

Oliver, Richard
Seeing your actual syntax might help diagnose the problem.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Pascal Heus
Sent: Monday, December 03, 2007 7:07 AM
To: [hidden email]
Subject: Formatting supported by the get data / data list commands

Hi:
I'm trying to import data from a fixed ASCII file using the GET FILE
command with the variable formats defined inline. The SPSS documentation
indicates the the syntax should be as follows:
...
VARIABLES subcommand for ARRANGEMENT = FIXED
  /VARIABLES [/rec#] varname startcol-endcol format

This works fine with common numeric formats or dates but when I try to
use less conventional formats like scientific notation (E16.2) or
date/time (DateTime17.0) I get an error message:
 >Error.  Command name: GET DATA
 >(2265) Unrecognized or invalid variable definition.
 >This command not executed.

Is there a limitation in the format specifications for the GET DATA and
DATA LIST commands? Is there a way around this? I know these ASCII files
contain the correct formatting as they were originally exported from
SPSS. How can I specify this on import? This is for a data conversion
utility application so it needs to work all common versions of SPSS (I'm
testing with 11).

many thanks
Pascal

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Formatting supported by the get data / data list commands

Pascal Heus
Oliver:
thanks for your feedback, syntax shown below (this is a for a test file
that contains all possible SPSS formats).
best
Pascal


* +=======+
* ! SETUP !
* +=======+

* Replace macro value below with path to data folder (inluding trainking
\ or /)
define !Folder () 'C:\eclipse-runtime-DExT\test\data\SPSSTest\' !enddefine.

* +=============+
* ! IMPORT DATA !
* +=============+

GET DATA  /TYPE = TXT
 /FILE = !Folder+'SPSSTest.fixed.dat'
 /FIXCASE = 1
 /ARRANGEMENT = FIXED
 /FIRSTCASE = 1
 /IMPORTCASE = ALL
 /VARIABLES =
 /1
   NUMERIC 0-7 F8.2
   NUMER16 8-23 F16.2
   NUMER16B 24-39 F16.0
   NUMER17 40-56 F17.2
   NUMER32 57-88 F32.2
   COMMA 89-96 Comma8.2
   DOT 97-104 Dot8.2
   SCIENT01 105-112 E8.2
   SCIENT02 113-128 E16.2
   SCIENTB2 129-143 E15.2
   SCIENTC2 144-160 E17.2
   SCIENT03 161-170 E10.4
   SCIENT04 171-178 E8.0
   DATE01 179-189 Date11
   DATE02 190-198 Date9
   DATE03 199-208 ADate10
   DATE04 209-216 ADate8
   DATE05 217-226 Edate10
   DATE06 227-234 Edate8
   DATE07 235-241 JDate7
   DATE08 242-246 JDate5
   DATE09 247-254 QYr8
   DATE10 255-260 QYr6
   DATE11 261-268 Moyr8
   DATE12 269-274 Moyr6
   DATE13 275-284 Wkyr10
   DATE14 285-292 Wkyr8
   DATE15 293-309 DateTime17.0
   DATE16 310-329 DateTime20.0
   DATE17 330-352 DateTime23.2
   DATE18 353-357 Time5.0
   DATE19 358-365 Time8.0
   DATE20 366-376 Time11.2
   DATE21 377-385 DTime9.0
   DATE22 386-397 DTime12.0
   DATE23 398-412 DTime15.2
   DATE24 413-421 Wkday9
   DATE25 422-424 Wkday3
   DATE26 425-427 Month3
   DOLLAR 428-442 Dollar15.2
   CUSTOMA 443-450 Cca8.2
   CUSTOMB 451-455 Ccb5.0
   STR8 456-463 A8
   STR250 464-713 A250
   YESNOMAY 714-714 F1.0
   WEIGHT1 715-724 F10.0
.
CACHE.
EXECUTE.


Oliver, Richard wrote:

> Seeing your actual syntax might help diagnose the problem.
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Pascal Heus
> Sent: Monday, December 03, 2007 7:07 AM
> To: [hidden email]
> Subject: Formatting supported by the get data / data list commands
>
> Hi:
> I'm trying to import data from a fixed ASCII file using the GET FILE
> command with the variable formats defined inline. The SPSS documentation
> indicates the the syntax should be as follows:
> ...
> VARIABLES subcommand for ARRANGEMENT = FIXED
>   /VARIABLES [/rec#] varname startcol-endcol format
>
> This works fine with common numeric formats or dates but when I try to
> use less conventional formats like scientific notation (E16.2) or
> date/time (DateTime17.0) I get an error message:
>  >Error.  Command name: GET DATA
>  >(2265) Unrecognized or invalid variable definition.
>  >This command not executed.
>
> Is there a limitation in the format specifications for the GET DATA and
> DATA LIST commands? Is there a way around this? I know these ASCII files
> contain the correct formatting as they were originally exported from
> SPSS. How can I specify this on import? This is for a data conversion
> utility application so it needs to work all common versions of SPSS (I'm
> testing with 11).
>
> many thanks
> Pascal
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Formatting supported by the get data / data list commands

Oliver, Richard
In reply to this post by Pascal Heus
Hmm...there would appear to be an undocumented format limitation for GET DATA /TYPE=TXT. It looks like N, PCT, and E formats are not supported. There may be others. DateTime worked okay in my simple test.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Pascal Heus
Sent: Monday, December 03, 2007 7:07 AM
To: [hidden email]
Subject: Formatting supported by the get data / data list commands

Hi:
I'm trying to import data from a fixed ASCII file using the GET FILE
command with the variable formats defined inline. The SPSS documentation
indicates the the syntax should be as follows:
...
VARIABLES subcommand for ARRANGEMENT = FIXED
  /VARIABLES [/rec#] varname startcol-endcol format

This works fine with common numeric formats or dates but when I try to
use less conventional formats like scientific notation (E16.2) or
date/time (DateTime17.0) I get an error message:
 >Error.  Command name: GET DATA
 >(2265) Unrecognized or invalid variable definition.
 >This command not executed.

Is there a limitation in the format specifications for the GET DATA and
DATA LIST commands? Is there a way around this? I know these ASCII files
contain the correct formatting as they were originally exported from
SPSS. How can I specify this on import? This is for a data conversion
utility application so it needs to work all common versions of SPSS (I'm
testing with 11).

many thanks
Pascal

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Formatting supported by the get data / data list commands

Pascal Heus
Oliver:
looks like a limitation indeed, strange. This does not seem the case
with DATA LIST, the difference being that you cannot specify the format
width inline but SPSS takes the best guess based on the actual number of
columns. I'll try with that command instead.
Many thanks for your input.
best
Pascal

Oliver, Richard wrote:

> Hmm...there would appear to be an undocumented format limitation for GET DATA /TYPE=TXT. It looks like N, PCT, and E formats are not supported. There may be others. DateTime worked okay in my simple test.
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Pascal Heus
> Sent: Monday, December 03, 2007 7:07 AM
> To: [hidden email]
> Subject: Formatting supported by the get data / data list commands
>
> Hi:
> I'm trying to import data from a fixed ASCII file using the GET FILE
> command with the variable formats defined inline. The SPSS documentation
> indicates the the syntax should be as follows:
> ...
> VARIABLES subcommand for ARRANGEMENT = FIXED
>   /VARIABLES [/rec#] varname startcol-endcol format
>
> This works fine with common numeric formats or dates but when I try to
> use less conventional formats like scientific notation (E16.2) or
> date/time (DateTime17.0) I get an error message:
>  >Error.  Command name: GET DATA
>  >(2265) Unrecognized or invalid variable definition.
>  >This command not executed.
>
> Is there a limitation in the format specifications for the GET DATA and
> DATA LIST commands? Is there a way around this? I know these ASCII files
> contain the correct formatting as they were originally exported from
> SPSS. How can I specify this on import? This is for a data conversion
> utility application so it needs to work all common versions of SPSS (I'm
> testing with 11).
>
> many thanks
> Pascal
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD