carriage return

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

carriage return

Giuseppina Chiri
Hello list,
I have searched the archives and found questions similar to mine, but I
was not able to understand the solution, so I wonder if anyone is willing
to explain this again.
I have a flat file with text (strings) enclosed in double quotes. However
there are carriage returns inside the double quotes that cause the file to
be read incorrectly.
Is there a way to tell SPSS to ignore the carriage return?
Any suggestion will be greatly appreciated!
Giusi
Reply | Threaded
Open this post in threaded view
|

Re: carriage return

Maguin, Eugene
Giusi,

Maybe Richard Ristow will know a way around this problem but I don't know of
one. My suggestion is to open the file up in Word and do a search and
replace on the carriage return character. That said, it strikes me as very,
very odd that there would be carriage return characters inside of double
quotes, i.e., embedded in your text strings. Why would somebody do that?

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: carriage return

Hoover, Matthew
Hi Gene,

Giusi is my friend from our years in grad school and I talked to her
before she asked her question.  Just to clarify, my understanding of her
problem is that people were hitting the enter key in the middle of a
text field, so some of the text that should have been included in 1
variable was placed on a new line.  Sometimes there are 2 or 3 separate
lines for 1 case.

It isn't a "carriage return character", but having one text variable on
multiple lines.

I don't know if there is a solution to the problem, but if there is, the
collective knowledge of this list will be sure to help!

Matt

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Gene Maguin
Sent: Thursday, June 21, 2007 11:54 AM
To: [hidden email]
Subject: Re: carriage return

Giusi,

Maybe Richard Ristow will know a way around this problem but I don't
know of
one. My suggestion is to open the file up in Word and do a search and
replace on the carriage return character. That said, it strikes me as
very,
very odd that there would be carriage return characters inside of double
quotes, i.e., embedded in your text strings. Why would somebody do that?

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: carriage return

Mike P-5
In reply to this post by Giuseppina Chiri
Do you have python installed onto your machine?
I'm sure I've done this with python on a previous problem, I'll have a
look back if you do

Mike


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Giuseppina Chiri
Sent: 21 June 2007 16:37
To: [hidden email]
Subject: carriage return

Hello list,
I have searched the archives and found questions similar to mine, but I
was not able to understand the solution, so I wonder if anyone is
willing
to explain this again.
I have a flat file with text (strings) enclosed in double quotes.
However
there are carriage returns inside the double quotes that cause the file
to
be read incorrectly.
Is there a way to tell SPSS to ignore the carriage return?
Any suggestion will be greatly appreciated!
Giusi

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

AW: carriage return

la volta statistics
In reply to this post by Giuseppina Chiri
Hi Giusi

here a solution that may help you.
The first part is to generate data with a carriage return in the variable x.
The second part then takes this carriage return out and replaces it with a
space.

Hope this helps
Christian


* First generate data with a carriage return in the variable x.
* Simon Freidin [[hidden email]] created this peace of code.
********************************************************************.
DATA LIST LIST /y (a2) .
BEGIN DATA
a
ab
END DATA.
string tab (a1) .
String x (a100).

compute tab=string(number('13',n2),pib1).
compute
x=concat("if",tab,"y=",tab,"""",ltrim(rtrim(y)),"""",tab,"code=",tab,".").
Exec.

List.


* Second: Now take the carriage return out of variable x.
********************************************************************.
DO IF (INDEX(x,string(number('13',n2),pib1))>0).
LOOP.
COMPUTE x = CONCAT(SUBSTR(x,1,INDEX(x,string(number('13',n2),pib1))-1)," ",

SUBSTR(x,INDEX(x,string(number('13',n2),pib1))+1,LENGTH(x)-INDEX(x,string(nu
mber('13',n2),pib1)))).
END LOOP IF (INDEX(x,string(number('13',n2),pib1))=0).
END IF.
EXECUTE.

List.


*******************************
la volta statistics
Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
Ch-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email: mailto:[hidden email]
internet: http://www.lavolta.ch/






-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]]Im Auftrag von
Giuseppina Chiri
Gesendet: Donnerstag, 21. Juni 2007 17:37
An: [hidden email]
Betreff: carriage return


Hello list,
I have searched the archives and found questions similar to mine, but I
was not able to understand the solution, so I wonder if anyone is willing
to explain this again.
I have a flat file with text (strings) enclosed in double quotes. However
there are carriage returns inside the double quotes that cause the file to
be read incorrectly.
Is there a way to tell SPSS to ignore the carriage return?
Any suggestion will be greatly appreciated!
Giusi