*(Q) In some fields, data contains embedded Carriage Return characters. The length of the value is the total length of the two or three lines. In the full screen view of the data editor, the variable shows only the characters up to the first carriage return but if I move to the cell with the multiple lines, all the lines show up in the 'current cell' box near the top of the screen. So, all the information is still there and I would like to convert the carriage returns into @ signs (or some other character) such that I can parse this information into lines. *HELP: can SPSS do a lookup for this special character. *(A) An initial response was posted to SPSSX-L list by Bjarte Aagnes on 2002/02/08. * The following (improved) syntax was subsequently emailed to me by Bjarte. ************************************************************ Comments to : Bjarte Aagnes, aagnes@statinet.no ************************************************************ *Preliminary step 1: *read some example data with = HEX 0d0a and HEX 41-6 = A-F. DATA LIST LIST /origin (AHEX30). BEGIN DATA 410d0a4243440d0a4546 46450d0a4443420d0a0d0a410d0a END DATA. EXE. *Preliminary step 2. FORMAT origin (A15). /*string variable with embedded cr>*/ ************************************************************ *Start program: change string to AHEX and print to file. FORMAT origin (AHEX30). PRINT OUTFILE=tmp.txt /origin. EXE. ************************************************************ *Read variable and parse. DATA LIST FILE = "tmp.txt" / origin (A15). DO IF (RINDEX(origin,"0D0A") > 0). + LOOP #j=1 TO 100. + STRING #str res (A30). + IF #j=1 #str=LTRIM(RTRIM(origin)). + COMP #p = INDEX(#str,"0D0A"). + COMP res = CON(RTRIM(res), SUB(#str,1,#p-1)). + COMP #str = SUB(#str,#p+4). + IF (RINDEX(#str,"0D0A")) = 0 res = CON(RTRIM(res),#str). + END LOOP IF RINDEX(#str,"0D0A") = 0. END IF. PRINT OUTFILE=tmp2.txt /origin res. EXE. *********************************************************** *read and convert back to prefered format (A15). DATA LIST LIST FILE = "tmp2.txt" / origin (AHEX30) res (AHEX30). FORMAT origin res (A15). EXE. LIST CASES /FORMAT=NUM.