Import from Excel "&" becomes "&"

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

Import from Excel "&" becomes "&"

Langston, Eric

Is there an additional subcommand that I need to use so that it doesn’t replace the ampersand symbol (&) with its html equivalent (&)?

 

For example:

Alabama Agricultural & Mechanical University                              becomes

Alabama Agricultural & Mechanical University                             

 

 

I usually just run some syntax like “COMPUTE str1 = REPLACE(str1,”&”,”&”).  But it would be easier to just avoid it in the first place …

 

Thanks for your help,

-Eric

 

 

Eric Langston

Research Associate

Office of Financial Aid

 

DePaul University

55 E Jackson Blvd, Flr 11

Chicago, IL 60604

(312) 362-8120

 

Reply | Threaded
Open this post in threaded view
|

Re: Import from Excel "&" becomes "&"

Tesiny, Ed
Eric,
Using test data in Excel:
First Bank & Trust
John & Sons      
ABC, XYZ & All   
 
Using:

 

GET DATA

/TYPE=XLS

/FILE='C:\Documents and Settings\TESINYE\My Documents\test.xls'

/SHEET=name 'Sheet1'

/CELLRANGE=full

/READNAMES=on

/ASSUMEDSTRWIDTH=32767.

DATASET NAME DataSet1 WINDOW=FRONT.

The data comes in fine:

First Bank & Trust
John & Sons      
ABC, XYZ & All   

 
Ed Tesiny
 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Langston, Eric
Sent: Tuesday, August 10, 2010 11:48 AM
To: [hidden email]
Subject: Import from Excel "&" becomes "&"

Is there an additional subcommand that I need to use so that it doesn’t replace the ampersand symbol (&) with its html equivalent (&)?

 

For example:

Alabama Agricultural & Mechanical University                              becomes

Alabama Agricultural & Mechanical University                             

 

 

I usually just run some syntax like “COMPUTE str1 = REPLACE(str1,”&”,”&”).  But it would be easier to just avoid it in the first place …

 

Thanks for your help,

-Eric

 

 

Eric Langston

Research Associate

Office of Financial Aid

 

DePaul University

55 E Jackson Blvd, Flr 11

Chicago, IL 60604

(312) 362-8120

 

Reply | Threaded
Open this post in threaded view
|

Re: Import from Excel "&" becomes "&"

Langston, Eric
In reply to this post by Langston, Eric

Ed,

Thanks for your response.  I just did a test and it works with XLS.  However, it does not work with XLSX (Excel 2007).

 

I found and filed a bug with SPSS when saving to an XLSX file – if you have a numeric variable with format F8.0 and the data has decimal values, the data are truncated in the resulting file at the decimal.

 

So, this may be a bug in a similar overture …

 

Any other thoughts?

 

Thanks,

-Eric

 

 

From: Tesiny, Ed [mailto:[hidden email]]
Sent: Tuesday, August 10, 2010 12:48 PM
Subject: Re: Import from Excel "&" becomes "&"

 

Eric,

Using test data in Excel:

First Bank & Trust
John & Sons      
ABC, XYZ & All   

 

Using:

 

GET DATA

/TYPE=XLS

/FILE='C:\Documents and Settings\TESINYE\My Documents\test.xls'

/SHEET=name 'Sheet1'

/CELLRANGE=full

/READNAMES=on

/ASSUMEDSTRWIDTH=32767.

DATASET NAME DataSet1 WINDOW=FRONT.

The data comes in fine:

First Bank & Trust
John & Sons      
ABC, XYZ & All   

 

Ed Tesiny

[hidden email]

 

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Langston, Eric
Sent: Tuesday, August 10, 2010 11:48 AM
To: [hidden email]
Subject: Import from Excel "&" becomes "&"

Is there an additional subcommand that I need to use so that it doesn’t replace the ampersand symbol (&) with its html equivalent (&)?

 

For example:

Alabama Agricultural & Mechanical University                              becomes

Alabama Agricultural & Mechanical University                             

 

 

I usually just run some syntax like “COMPUTE str1 = REPLACE(str1,”&”,”&”).  But it would be easier to just avoid it in the first place …

 

Thanks for your help,

-Eric

 

 

Eric Langston

Research Associate

Office of Financial Aid

 

DePaul University

55 E Jackson Blvd, Flr 11

Chicago, IL 60604

(312) 362-8120

 

Reply | Threaded
Open this post in threaded view
|

Re: Import from Excel "&" becomes "&"

Albert-Jan Roskam
Hi,
 
AFAIK, Excel 2007 (.xlsx) is .xml based. In xml, '&amp' is a predefined entity reference that stands for the ampersand sign (& itself has a special meaning in xml). Thus, I'd simply try to save the file in an older, non-xml,  xls version and then try to import that into Spss.
 
Cheers!!
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From: "Langston, Eric" <[hidden email]>
To: [hidden email]
Sent: Wed, August 11, 2010 4:21:43 PM
Subject: Re: [SPSSX-L] Import from Excel "&" becomes "&amp;"

Ed,

Thanks for your response.  I just did a test and it works with XLS.  However, it does not work with XLSX (Excel 2007).

 

I found and filed a bug with SPSS when saving to an XLSX file – if you have a numeric variable with format F8.0 and the data has decimal values, the data are truncated in the resulting file at the decimal.

 

So, this may be a bug in a similar overture …

 

Any other thoughts?

 

Thanks,

-Eric

 

 

From: Tesiny, Ed [mailto:[hidden email]]
Sent: Tuesday, August 10, 2010 12:48 PM
Subject: Re: Import from Excel "&" becomes "&amp;"

 

Eric,

Using test data in Excel:

First Bank & Trust
John & Sons      
ABC, XYZ & All   

 

Using:

 

GET DATA

/TYPE=XLS

/FILE='C:\Documents and Settings\TESINYE\My Documents\test.xls'

/SHEET=name 'Sheet1'

/CELLRANGE=full

/READNAMES=on

/ASSUMEDSTRWIDTH=32767.

DATASET NAME DataSet1 WINDOW=FRONT.

The data comes in fine:

First Bank & Trust
John & Sons      
ABC, XYZ & All   

 

Ed Tesiny

[hidden email]

 

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Langston, Eric
Sent: Tuesday, August 10, 2010 11:48 AM
To: [hidden email]
Subject: Import from Excel "&" becomes "&amp;"

Is there an additional subcommand that I need to use so that it doesn’t replace the ampersand symbol (&) with its html equivalent (&amp;)?

 

For example:

Alabama Agricultural & Mechanical University                              becomes

Alabama Agricultural &amp; Mechanical University                             

 

 

I usually just run some syntax like “COMPUTE str1 = REPLACE(str1,”&amp;”,”&”).  But it would be easier to just avoid it in the first place …

 

Thanks for your help,

-Eric

 

 

Eric Langston

Research Associate

Office of Financial Aid

 

DePaul University

55 E Jackson Blvd, Flr 11

Chicago, IL 60604

(312) 362-8120