Bug in Excel import range - found in 17.0

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Bug in Excel import range - found in 17.0

Allan Reese (Cefas)

This is so basic I’m starting to lose faith in the product.  I haven’t previously used RANGE as I usually want to know everything on a sheet or resort to cut’n’paste.

I’m using SPSS17.0.1 (Dec 2008) but can’t trace on the web that it’s been fixed since.  Reading from Excel 2007.

 

The issue is that if the range is specified but the first line contains names, SPSS reads an extra row – duh, why do you think I told you the END cell?

Here’s an output:

 

new file.

GET DATA /TYPE=XLSX

  /FILE='C:\projects\litter\smallsheet.xlsx'

  /SHEET=name 'Sheet1'

  /CELLRANGE=range 'A1:B5'

  /READNAMES=on

  /ASSUMEDSTRWIDTH=32767.

LIST .

 

 

 

List

 

 

 

Notes

Output Created

14-Sep-2011 17:11:19

Comments

 

Input

Filter

<none>

Weight

<none>

Split File

<none>

N of Rows in Working Data File

5

Syntax

LIST .

 

Resources

Processor Time

0:00:00.000

Elapsed Time

0:00:00.000

 

 

 

        row           x

 

          1           1

          2           1

          3           1

          4           1

          5           1

 

 

Number of cases read:  5    Number of cases listed:  5

 

 

 

 

new file.

GET DATA /TYPE=XLSX

  /FILE='C:\projects\litter\smallsheet.xlsx'

  /SHEET=name 'Sheet1'

  /CELLRANGE=range 'A1:B5'

  /READNAMES=off

  /ASSUMEDSTRWIDTH=32767.

LIST .

 

 

 

List

 

 

 

Notes

Output Created

14-Sep-2011 17:11:19

Comments

 

Input

Filter

<none>

Weight

<none>

Split File

<none>

N of Rows in Working Data File

5

Syntax

LIST .

 

Resources

Processor Time

0:00:00.016

Elapsed Time

0:00:00.016

 

 

 

 

V1  V2

 

row x

1   1

2   1

3   1

4   1

 

 

Number of cases read:  5    Number of cases listed:  5

 

Having quoted to a colleague yesterday, “computers do what you tell them, not what you want”, I’m pretty annoyed to have my day wasted tracing why SPSS is precisely NOT doing what I told it to.

 

The syntax guide is unambiguous:

RANGE ‘start:end’ Read the specified range of cells. Specify the beginning column letter and row number, a colon, and the ending column letter and row number, as in A1:K14.





This email and any attachments are intended for the named recipient only. Its unauthorised use, distribution, disclosure, storage or copying is not permitted. If you have received it in error, please destroy all copies and notify the sender. In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of Cefas. Communications on Cefas’ computer systems may be monitored and/or recorded to secure the effective operation of the system and for other lawful purposes.