|
I'm trying to create a variable using the STRING command. SPSS shows that it completes without error, but the variable doesn't show up and a subsequent COMPUTE command fails.
* Source variable for UK STRING SourceVar (A10). EXECUTE. COMPUTE SourceVar = "UK". EXECUTE. Can anyone see what's wrong? I'm using V16. Thanks Mike |
|
SPSS is reading the word STRING as a continuation of the comment.
So put a period or a blank line after the comment in first line. Ending with a
period is better. I like to do both. It’s not necessary to have two Execute
commands. * Source variable for UK. STRING SourceVar (A10). COMPUTE SourceVar = "UK". King Douglas From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Mike Pritchard I'm trying to create a variable using the STRING
command. SPSS shows that it completes without error, but the variable
doesn't show up and a subsequent COMPUTE command fails. |
|
Thanks. I struggle with SPSS comments, especially since I'm doing some programming in a different language with other comment syntax.
Mike On Sat, Feb 6, 2010 at 12:47 PM, King Douglas <[hidden email]> wrote:
|
|
If you are using the syntax editor in V17 or later, you should notice that comments appear in a different color, helping you to spot omitted periods. Jon Peck SPSS, an IBM Company [hidden email] 312-651-3435
Thanks. I struggle with SPSS comments, especially since I'm doing some programming in a different language with other comment syntax. Mike On Sat, Feb 6, 2010 at 12:47 PM, King Douglas <king_d@...> wrote: SPSS is reading the word STRING as a continuation of the comment. So put a period or a blank line after the comment in first line. Ending with a period is better. I like to do both. It’s not necessary to have two Execute commands.
* Source variable for UK. STRING SourceVar (A10). COMPUTE SourceVar = "UK".
King Douglas
From: SPSSX(r) Discussion [mailto:[hidden email]]
On Behalf Of Mike Pritchard
I'm trying to create a variable using the STRING command.
SPSS shows that it completes without error, but the variable doesn't show
up and a subsequent COMPUTE command fails.
|
|
In reply to this post by Mike Pritchard-4
"SPSS shows that it completes without error, but the variable doesn't show up and a subsequent COMPUTE command fails."
Problem solved but nonetheless you should get an error message as well, providing you with at least a clue about what's going wrong (in V15 at least): >Error # 4309 in column 256. Text: (End of Command) >Invalid combination of data types in an assignment. Character strings may >only be assigned to string variables. Numeric and logical quantities may >only be assigned to numeric variables. Consider using the STRING or NUMBER >function. >This command not executed. Best regards, Ruben van den Berg Methodologist TNS NIPO P: +31 20 522 5738 data list free/bla. begin data 0 end data. *oops STRING SourceVar (A10). EXECUTE. COMPUTE SourceVar = "UK". EXECUTE. Date: Sat, 6 Feb 2010 12:00:07 -0800 From: [hidden email] Subject: STRING command doesn't seem to create variable To: [hidden email] I'm trying to create a variable using the STRING command. SPSS shows that it completes without error, but the variable doesn't show up and a subsequent COMPUTE command fails. * Source variable for UK STRING SourceVar (A10). EXECUTE. COMPUTE SourceVar = "UK". EXECUTE. Can anyone see what's wrong? I'm using V16. Thanks Mike New Windows 7: Find the right PC for you. Learn more. |
|
Ruben, You are right. Thanks for the correction.
I didn’t give complete enough information. When I ran the first couple
of lines, there was no error- because as someone else pointed out the comment
was only concluded by the period at the end of the STRING command. But when I
ran all the lines, or just the last couple, the error message was displayed. Same
thing with V16 as V15. Mike From: SPSSX(r)
Discussion [mailto:[hidden email]] On
Behalf Of Ruben van den Berg "SPSS shows that it completes without error, but the variable doesn't
show up and a subsequent COMPUTE command fails." Problem solved but nonetheless you should get an error
message as well, providing you with at least a clue about what's going wrong
(in V15 at least): >Error # 4309 in column 256. Text: (End of
Command) >Invalid combination of data types in an assignment.
Character strings may >only be assigned to string variables. Numeric
and logical quantities may >only be assigned to numeric variables. Consider
using the STRING or NUMBER >function. >This command not executed. Best regards, Ruben
van den Berg Methodologist TNS NIPO P: +31 20 522 5738 data list free/bla. begin data 0 end data. *oops STRING SourceVar (A10). EXECUTE. COMPUTE SourceVar = " EXECUTE. Date: Sat, 6 Feb 2010 12:00:07 -0800 New Windows 7: Find the right PC for you. Learn more. |
| Free forum by Nabble | Edit this page |
