Hi Guys:
I have this problem. I need to evaluate a data base with 3000 variables and the main thing is to verify that if a person answers a question he should answer others, for example if he has a car (var1=2) then he should answer "Kind of car" (var2= somevalue ). I want to evaluate this, so the syntax should be like this: IF (var1= 2 AND V2 = SYSMISS ). Error = 1 But I get an error. What's the sintax needed for this? Thanks for your time. |
Try this,
IF (var1= 2 & SYSMISS(v2) ). Error = 1 Thanks, Mahbub -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eugenio Grant Sent: 29-Nov-06 11:38 AM To: [hidden email] Subject: Validating Data (This should be simple!!!!) Hi Guys: I have this problem. I need to evaluate a data base with 3000 variables and the main thing is to verify that if a person answers a question he should answer others, for example if he has a car (var1=2) then he should answer "Kind of car" (var2= somevalue ). I want to evaluate this, so the syntax should be like this: IF (var1= 2 AND V2 = SYSMISS ). Error = 1 But I get an error. What's the sintax needed for this? Thanks for your time. |
In reply to this post by Eugenio Grant
It looks to me like you need to move your period from before 'Error = 1'
to after it. IF (var1= 2 AND V2 = SYSMISS ) Error = 1. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eugenio Grant Sent: Wednesday, November 29, 2006 10:38 AM To: [hidden email] Subject: [SPSSX-L] Validating Data (This should be simple!!!!) Hi Guys: I have this problem. I need to evaluate a data base with 3000 variables and the main thing is to verify that if a person answers a question he should answer others, for example if he has a car (var1=2) then he should answer "Kind of car" (var2= somevalue ). I want to evaluate this, so the syntax should be like this: IF (var1= 2 AND V2 = SYSMISS ). Error = 1 But I get an error. What's the sintax needed for this? Thanks for your time. PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
In reply to this post by Eugenio Grant
You misspelled SYSMIS and the period shd go after the 1.
IF (var1 = 2 AND V2 = SYSMIS ) Error = 1. Dominic Lusinchi Statistician Far West Research Statistical Consulting San Francisco, California 415-664-3032 www.farwestresearch.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eugenio Grant Sent: Wednesday, November 29, 2006 8:38 AM To: [hidden email] Subject: Validating Data (This should be simple!!!!) Hi Guys: I have this problem. I need to evaluate a data base with 3000 variables and the main thing is to verify that if a person answers a question he should answer others, for example if he has a car (var1=2) then he should answer "Kind of car" (var2= somevalue ). I want to evaluate this, so the syntax should be like this: IF (var1= 2 AND V2 = SYSMISS ). Error = 1 But I get an error. What's the sintax needed for this? Thanks for your time. |
In reply to this post by Melissa Ives
Hello,
The V2 = SYSMISS might make problems. There is a function missing/or sysmis which returns true if the value of V2 is missing: IF (var1= 2 AND missing(V2) ) Error = 1. HTH Jindra > ------------ Původní zpráva ------------ > Od: Melissa Ives <[hidden email]> > Předmět: Re: Validating Data (This should be simple!!!!) > Datum: 29.11.2006 18:01:57 > ---------------------------------------- > It looks to me like you need to move your period from before 'Error = 1' > to after it. > > IF (var1= 2 AND V2 = SYSMISS ) Error = 1. > > Melissa > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of > Eugenio Grant > Sent: Wednesday, November 29, 2006 10:38 AM > To: [hidden email] > Subject: [SPSSX-L] Validating Data (This should be simple!!!!) > > Hi Guys: > > > > I have this problem. > > > > I need to evaluate a data base with 3000 variables and the main thing is > to verify that if a person answers a question he should answer others, > for example if he has a car (var1=2) then he should answer "Kind of car" > (var2= somevalue ). > > > > I want to evaluate this, so the syntax should be like this: > > > > IF (var1= 2 AND V2 = SYSMISS ). Error = 1 > > > > But I get an error. > > > > What's the sintax needed for this? > > > > Thanks for your time. > > > > PRIVILEGED AND CONFIDENTIAL INFORMATION > This transmittal and any attachments may contain PRIVILEGED AND > CONFIDENTIAL information and is intended only for the use of the > addressee. If you are not the designated recipient, or an employee > or agent authorized to deliver such transmittals to the designated > recipient, you are hereby notified that any dissemination, > copying or publication of this transmittal is strictly prohibited. If > you have received this transmittal in error, please notify us > immediately by replying to the sender and delete this copy from your > system. You may also call us at (309) 827-6026 for assistance. > > > |
Another one: if (var1=2 and sysmis(v2)) error=1 .
> Hello, > > The V2 = SYSMISS might make problems. There is a function missing/or sysmis > which returns true if the value of V2 is missing: > IF (var1= 2 AND missing(V2) ) Error = 1. > > HTH > Jindra > > > > ------------ Pùvodní zpráva ------------ > > Od: Melissa Ives <[hidden email]> > > Pøedmìt: Re: Validating Data (This should be simple!!!!) > > Datum: 29.11.2006 18:01:57 > > ---------------------------------------- > > It looks to me like you need to move your period from before 'Error = 1' > > to after it. > > > > IF (var1= 2 AND V2 = SYSMISS ) Error = 1. > > > > Melissa > > > > -----Original Message----- > > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of > > Eugenio Grant > > Sent: Wednesday, November 29, 2006 10:38 AM > > To: [hidden email] > > Subject: [SPSSX-L] Validating Data (This should be simple!!!!) > > > > Hi Guys: > > > > > > > > I have this problem. > > > > > > > > I need to evaluate a data base with 3000 variables and the main thing is > > to verify that if a person answers a question he should answer others, > > for example if he has a car (var1=2) then he should answer "Kind of car" > > (var2= somevalue ). > > > > > > > > I want to evaluate this, so the syntax should be like this: > > > > > > > > IF (var1= 2 AND V2 = SYSMISS ). Error = 1 > > > > > > > > But I get an error. > > > > > > > > What's the sintax needed for this? > > > > > > > > Thanks for your time. > > > > > > > > PRIVILEGED AND CONFIDENTIAL INFORMATION > > This transmittal and any attachments may contain PRIVILEGED AND > > CONFIDENTIAL information and is intended only for the use of the > > addressee. If you are not the designated recipient, or an employee > > or agent authorized to deliver such transmittals to the designated > > recipient, you are hereby notified that any dissemination, > > copying or publication of this transmittal is strictly prohibited. If > > you have received this transmittal in error, please notify us > > immediately by replying to the sender and delete this copy from your > > system. You may also call us at (309) 827-6026 for assistance. > > > > > > > |
In reply to this post by Eugenio Grant
At 11:38 AM 11/29/2006, Eugenio Grant wrote:
>I want to evaluate this, so the syntax should be like this: > >IF (var1= 2 AND V2 = SYSMISS ). Error = 1 > >But I get an error. You've had answers on this. To amplify a bit, A. Your error message, as others have said, is probably due to the misplaced period. B. Move the period, and 'SYSMIS' will be taken as a regular variable, and you'll get an error message for using an undefined variable. C. Change the statement to IF (var1= 2 AND V2 = $SYSMIS) Error = 1. and it's syntactically valid. But the test will never evaluate 'true', and variable 'Error' will never be set to 1. In SPSS, "missing" is not a specific value of a quantity; it is taken that the quantity has some value, but that value is unknown. If the value of "$SYSMIS" is unknown (that's how the logic works), it's impossible to test whether V2 has that value, so the result of the test "V2=$SYSMIS" is 'missing', never 'true' or 'false'. By SPSS's logic of combining tests (it is correct logic), if var1 is not 2, the combined test will evaluate 'false' and Error will not be set to 1. If var1 is 2, the combined test will evaluate 'missing', and Error will still not be set to 1. That's why, to make it work, you have to write it (others have given this form) IF (var1= 2 AND SYSMIS(V2)) Error = 1. |
Free forum by Nabble | Edit this page |