Basic computing new variable question from new member

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

Basic computing new variable question from new member

John Stachula
I am new to the list and a more novice user and I cannot figure out the
problem I am encountering so I am hoping someone can help.  I am trying to
compute a new variable that will give me a total score from a survey I have
administered.  Each question in the survey (testing some basic knowledge)
is either correct or incorrect (values of 1 or 0 only and no non number
values) and I am trying to create a new variable that will be a total score
from the current variables that are subject answers to each question.  I
use the transform and then compute variable commands and ask the new
variable to simply be adding up the value for each of the questions and I
get:
"Error #4307 in column 1024.  Text: (End of Command
One of the operands for an arithmetic operation is other than a numeric
variable or numeric expression.
This command not executed."

I have also run in to a problem called:
"Warning #4461 in column 18. Text: Knol_tot
An unknown variable name was specified on the VAR LABELS command.  The name
and label will be ignored."

Any help would be greatly appreciated as all instructions I have been able
to read about how to compute a new variable are a match for what I am doing
and yet it is still not working for me.

Thanks in davance for your time and assistance and please feel free to
contact me directly or post here to the list with any responses!

John Stachula
[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
Reply | Threaded
Open this post in threaded view
|

Re: Basic computing new variable question from new member

Johnny Amora
Each of your questions has 0 or 1 response.  Suppose you have five questions such as Q1, Q2, Q3, Q4, and Q5.  The syntax to get the "total" is:
 
COMPUTE total=sum(Q1 to Q5).
EXECUTE.
 
Or, just type the Qs separated by comma:
 
COMPUTE sum1=sum(Q1,Q2,Q3,Q4,Q5).
EXECUTE.
 
Hope this helps.
Johnny


--- On Sat, 4/18/09, John Stachula <[hidden email]> wrote:

From: John Stachula <[hidden email]>
Subject: Basic computing new variable question from new member
To: [hidden email]
Date: Saturday, 18 April, 2009, 10:07 PM

I am new to the list and a more novice user and I cannot figure out the
problem I am encountering so I am hoping someone can help.  I am trying to
compute a new variable that will give me a total score from a survey I have
administered.  Each question in the survey (testing some basic knowledge)
is either correct or incorrect (values of 1 or 0 only and no non number
values) and I am trying to create a new variable that will be a total score
from the current variables that are subject answers to each question.  I
use the transform and then compute variable commands and ask the new
variable to simply be adding up the value for each of the questions and I
get:
"Error #4307 in column 1024.  Text: (End of Command
One of the operands for an arithmetic operation is other than a numeric
variable or numeric expression.
This command not executed."

I have also run in to a problem called:
"Warning #4461 in column 18. Text: Knol_tot
An unknown variable name was specified on the VAR LABELS command.  The name
and label will be ignored."

Any help would be greatly appreciated as all instructions I have been able
to read about how to compute a new variable are a match for what I am doing
and yet it is still not working for me.

Thanks in davance for your time and assistance and please feel free to
contact me directly or post here to the list with any responses!

John Stachula
stachulajohnp@...

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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


Open emails faster.
Yahoo! recommends that you upgrade your browser to the new Internet Explorer 8 optimized for Yahoo!.Get it here! (It's free)
Reply | Threaded
Open this post in threaded view
|

Re: Basic computing new variable question from new member

Hector Maletta

An addition: the EXECUTE command is unnecessary. The creation of a new variable is a transformation command (it transforms the data file), that is executed only when a new reading pass of the data is needed. SPSS performs the calculation for each case as it reads the data. You can cause SPSS to read the data (and calculate the value of the new variable for each case) with EXECUTE, but the same effect is obtained when you ask for any statistical procedure that requires reading the data, such as FREQUENCIES total, which would give you the frequency distribution of the new variable you have created, or CROSSTABS total by sex, which would produce a crosstabulation of that variable by sex, and so on. Using EXECUTE is redundant, since you always will need your new variable in some kind of procedure like FREQUENCIES or CROSSTABS, and EXECUTE is also time consuming: in a small database it runs perhaps in a second or two, but it may take some time when your database is large.

 

Hector

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Johnny Amora
Sent: 18 April 2009 11:53
To: [hidden email]
Subject: Re: Basic computing new variable question from new member

 

Each of your questions has 0 or 1 response.  Suppose you have five questions such as Q1, Q2, Q3, Q4, and Q5.  The syntax to get the "total" is:

 

COMPUTE total=sum(Q1 to Q5).
EXECUTE.

 

Or, just type the Qs separated by comma:

 

COMPUTE sum1=sum(Q1,Q2,Q3,Q4,Q5).
EXECUTE.

 

Hope this helps.

Johnny


--- On Sat, 4/18/09, John Stachula <[hidden email]> wrote:


From: John Stachula <[hidden email]>
Subject: Basic computing new variable question from new member
To: [hidden email]
Date: Saturday, 18 April, 2009, 10:07 PM

I am new to the list and a more novice user and I cannot figure out the
problem I am encountering so I am hoping someone can help.  I am trying to
compute a new variable that will give me a total score from a survey I have
administered.  Each question in the survey (testing some basic knowledge)
is either correct or incorrect (values of 1 or 0 only and no non number
values) and I am trying to create a new variable that will be a total score
from the current variables that are subject answers to each question.  I
use the transform and then compute variable commands and ask the new
variable to simply be adding up the value for each of the questions and I
get:
"Error #4307 in column 1024.  Text: (End of Command
One of the operands for an arithmetic operation is other than a numeric
variable or numeric expression.
This command not executed."

I have also run in to a problem called:
"Warning #4461 in column 18. Text: Knol_tot
An unknown variable name was specified on the VAR LABELS command.  The name
and label will be ignored."

Any help would be greatly appreciated as all instructions I have been able
to read about how to compute a new variable are a match for what I am doing
and yet it is still not working for me.

Thanks in davance for your time and assistance and please feel free to
contact me directly or post here to the list with any responses!

John Stachula
stachulajohnp@...

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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

 


Open emails faster.
Yahoo! recommends that you upgrade your browser to the new Internet Explorer 8 optimized for Yahoo!.Get it here! (It's free)