|
I'm having
difficulty removing trailing blanks from a dataset that I have. The original
data(P1) was downloaded to EXCEL and then I had SPSS read the dataset. I
am using the following syntax to create a new variable (P1A) which should
eliminate the trailing blanks:
STRING P1A
(A30).
COMPUTE P1A=RTRIM(P1). EXECUTE. However the
blanks are still there when I paste values of P1A into syntax. Any help would be
greatly appreciated....
Jerry Weinberg,
Ph.D
Director, Office
of Institutional Research
_____________________________
St. Thomas
University
16401 NW 37th
Avenue
Miami Gardens, FL
33054
(305)
474-6886
|
|
Jerry,
There's something you don't understand about string variables that is tripping you up. The command STRING P1A (A30) creates a variable named P1A as a 30 character wide string variable and fills those 30 characters with 30 spaces. When you right trim P1 and stick the result in P1A, trailing space characters are shaved off and the remaining characters, including embedded space characters, are stuffed into P1A. Characters in P1A not replaced remain as space characters. This is something you need to read up on. Look at the syntax reference manual in the variables subsection of the universals section and in the string functions subsection of the same main section. While you're looking up stuff, look at the Alter type command. This may come in useful to you. A better question, maybe, is what are you trying to accomplish doing trim operation? Gene Maguin I'm having difficulty removing trailing blanks from a dataset that I have. The original data(P1) was downloaded to EXCEL and then I had SPSS read the dataset. I am using the following syntax to create a new variable (P1A) which should eliminate the trailing blanks: STRING P1A (A30). COMPUTE P1A=RTRIM(P1). EXECUTE. However the blanks are still there when I paste values of P1A into syntax. Any help would be greatly appreciated.... Jerry Weinberg, Ph.D Director, Office of Institutional Research _____________________________ St. Thomas University 16401 NW 37th Avenue Miami Gardens, FL 33054 (305) 474-6886 [hidden email] ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Weinberg, Jerry
There's a thread on this somewhere in the archives,
with a solution.
|
| Free forum by Nabble | Edit this page |
