carriage return -rephrased-

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

carriage return -rephrased-

Giuseppina Chiri
Hello again,
my original question (below) was not very clear and would like to rephrase
it:
what happens is that those who enter the text may hit return after a
sentence thus placing the rest of the text on a new line.
I apologize for the confusion my first message may have caused.
Thanks again!
Giuis




_____________________________________
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

Richard Ristow
At 12:10 PM 6/21/2007, Giuseppina Chiri wrote:

>what happens is that those who enter the text may hit return after a
>sentence thus placing the rest of the text, [which should be part of
>the same variable,] on a new line.

And at 12:12 PM 6/21/2007, Hoover, Matthew wrote:

>My understanding of [the] 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.

OK, first: Removing carriage returns, or other unprintable and
undesired characters, from an SPSS string value has been worked out. It
can be done either in Python or in native SPSS. See citations at the
end of this note.(*)

But that isn't your problem. You have, I take it, data lines that were
being keyed in. Your data-entry people sometimes hit carriage-return
when they shouldn't have, thereby breaking one case across multiple
lines.

There are various ways of handling this, including using standard
editors to reunite the lines, if the file isn't too large.

In SPSS, it can probably be handled by REPEAT within an INPUT PROGRAM,
but we'd have to see some lines of data with and without the problem,
and your DATA LIST or other code for reading the file, to say more.
...................................
(*) Related threads forming one exchange.
     Recommend Ristow/Peck solution of 31 Jan-01 Feb.

Wed,  6 Dec 2006 <09:55:07 +0100>ff, "Non-printing characters";

Wed, 31 Jan 2007 <00:09:20 +0000>ff, "Deleting embedded control
characters in very long strings":
Wed, 31 Jan 2007 <23:27:49 -0500>    SPSS solution by R. Ristow;
Thu,  1 Feb 2007 <08:02:20 -0600>    Improvement by Jon Peck.

Fri, 23 Feb 2007 <00:52:59 +0000>ff, "Deleting embedded control
characters...":
Fri, 23 Feb 2007 <08:38:39 -0600>    Jon Peck, using Python
Fri, 23 Feb 2007 >12:37:00 -0800>    Repeat Ristow solution