Quantcast

Importing data from Excel - SPSS won't bring in full field

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Importing data from Excel - SPSS won't bring in full field

Sundance Kid
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I am importing a data field from excel that has file names in it. For example the excel field has the text 'results.xls'. This field imports correctly into SPSS and I end up with a field with the file name results.xls in my SPSS file. Now for the filenames in the excel spreadsheet column that end in .csv - these are never imported correctly. So when I try to import the field containing 'results.csv' SPSS will only import part of the name and in my SPSS data file I end up with 'results.' i.e. the .csv is always removed. Why is this? I am using SPSS version 19 in case that matters.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Importing data from Excel - SPSS won't bring in full field

Bruce Weaver
Administrator
As the output below shows, I am unable to duplicate your problem using SPSS 24.0 for Windows.  In every case, the listed results match exactly the contents of the original input file.  

GET DATA
  /TYPE=XLSX
  /FILE='C:\Temp\Junk.xlsx'
  /SHEET=name 'Sheet1'
  /CELLRANGE=FULL
  /READNAMES=ON
  /DATATYPEMIN PERCENTAGE=95.0
  /HIDDEN IGNORE=YES.
EXECUTE.
LIST.

List

filename     stringvar numvar

results.xls  a            1
results.csv  b            2
results.xlsx c            3
results.txt  d            4
results.sav  e            5

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


GET DATA
  /TYPE=XLS
  /FILE='C:\Temp\Junk.xls'
  /SHEET=name 'Sheet1'
  /CELLRANGE=FULL
  /READNAMES=ON
  /DATATYPEMIN PERCENTAGE=95.0.
EXECUTE.
LIST.

List

filename     stringvar      numvar

results.xls  a                   1
results.csv  b                   2
results.xlsx c                   3
results.txt  d                   4
results.sav  e                   5


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

PRESERVE.
SET DECIMAL DOT.

GET DATA  /TYPE=TXT
  /FILE="C:\Temp\Junk.csv"
  /ENCODING='UTF8'
  /DELCASE=LINE
  /DELIMITERS=","
  /ARRANGEMENT=DELIMITED
  /FIRSTCASE=2
  /DATATYPEMIN PERCENTAGE=95.0
  /VARIABLES=
  filename AUTO
  stringvar AUTO
  numvar AUTO
  /MAP.
RESTORE.
CACHE.
LIST.

List

filename     stringvar numvar

results.xls  a            1
results.csv  b            2
results.xlsx c            3
results.txt  d            4
results.sav  e            5

Data written to the working file.
3 variables and 5 cases written.
Variable: filename           Type: String  Format : A12        One or more values were truncated.
Variable: stringvar          Type: String  Format : A1
Variable: numvar             Type: Number  Format : F1

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




Sundance Kid wrote
I am importing a data field from excel that has file names in it. For example the excel field has the text 'results.xls'. This field imports correctly into SPSS and I end up with a field with the file name results.xls in my SPSS file. Now for the filenames in the excel spreadsheet column that end in .csv - these are never imported correctly. So when I try to import the field containing 'results.csv' SPSS will only import part of the name and in my SPSS data file I end up with 'results.' i.e. the .csv is always removed. Why is this? I am using SPSS version 19 in case that matters.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Importing data from Excel - SPSS won't bring in full field

Sundance Kid
This post has NOT been accepted by the mailing list yet.
Okay. Thank you for doing this; really appreciate it. It might be a problem related to earlier versions like version 19.
Loading...