• Re: How to remove CR/LF characters from a string

    From Chris Keran@21:1/5 to JKPeck on Wed Nov 29 07:19:08 2023
    On Wednesday, April 4, 2007 at 7:14:32 AM UTC-5, JKPeck wrote:
    On Apr 4, 4:52 am, peter m sopp <[email protected]> wrote:
    Two possible ways:
    - external editor (like Xemacs) (with export and re-import data - that's the way I've solved some similar problems)
    - python (should work I think - someone with an idea?)
    Peter

    Andreas Völp schrieb:

    In SPSS 15, I have a data set (improted from MS Access via ODBC) with several string variables some of which contain cariage return / line feed (CR/LF) characters. In text-based reports these characters cause a disruption of the column alignment, and therefore I would like to remove them from the strings (by replacing CR/LF by a blank).

    How can I do this? I couldn't find any way of specifying the CR/LF characters so that I can use them in a COMPUTE command. Isn't there anything
    like an ANSI or ASCII function that allows me to refer to these characters
    by their character table numbers?
    For clarity, this code deals with the cr and lf separately, Change
    the second line to use '' as the replacement character if you want
    only a single blank.

    compute strvar = replace(strvar, string(10, ib1),' ').
    compute strvar = replace(strvar, string(12, ib1),' ').
    HTH,
    Jon Peck
    SPSS
    Thank you, Jon, this worked for me too just now.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)