Deleting control characters from very long text field

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

Deleting control characters from very long text field

Kevin Hynes
Hi,

I am using SPSS ODBC to read data stored in a csv file in MS Access because
this allows me to read in a very log string field without truncation.
However, my formatting is plagued by unwanted control characters that act
lik line feeds/carriagge returns. Below is a sample comment:

    1. For the first examination, I was seated in the back row for a slide
show practical examination. Some of the slides which required students
to identify structures and properly name them were hazy and one, #19,
was impossible for me to make out. After I found out what the right
answer was, had I been able to see it, I would have gotten the
question right. This resulted in me taking a hit moving my final grade
down from a B+ to a straight  B.  All other tests were fair.

In searching the listserv, I came across a few posts related to this issue.
But none has seemed to work for my situation.

My text field is called COMMENT.

The following was from a Jon Peck post in 2004.
do repeat var=list-of-variables.
COMPUTE locHex01 = index(var,' ') .
if (locHex01 >0) v1 = substr(var,1,locHex01-1).
end repeat.
exec.

My attempt to implement it was as follows:
DO REPEAT VAR=COMMENT.
COMPUTE LOCHEX01 = INDEX(VAR,' ').
IF (LOCHEX01 > 0)VAR = SUBSTR(VAR,1,LOCHEX01-1).
END REPEAT.
EXECUTE.

But all the above did was blank out the comment entirely.

Another post recommended exporting and then importing the file. While this
did replace the control characters with zeros, it also truncated the field
to 255 characters which is not acceptable.

A post from Raynald Levesque was something like the following:
I do not believe this can be done with syntax alone.
I would use a script to read each value of that variable;
It is easy with a script to locate vbCR and replace them with whatever is
required eg '&'
I would print the result to a text file;
Then add the text file as a new variable in the data file.

Any help is appreciated. Thanks. Kevin

_________________________________________________________________
Type your favorite song.  Get a customized station.  Try MSN Radio powered
by Pandora. http://radio.msn.com/?icid=T002MSN03A07001
Reply | Threaded
Open this post in threaded view
|

Ancova regression homogeneity plotting question

Maguin, Eugene
All,

Some of the ancovas I comptuted have significant values for the between
factor by covariate effect. In the past I have plotted the predicted and
covariate by between factor value to look for the crossover point for use in
subsequent emmeans commands. However, Dave Nichols from spss sent me a
message about how to do this in glm. I think the trick is to specify 'no
intercept'. Can any one confirm that and say whether this is enough or if
something else is required.

Thanks, Gene Maguin