Validating Multiple Variables

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

Validating Multiple Variables

Eugenio Grant
Hi Guys:





I have this situation,



Id   V1   V2   V3   X1  X2   X3

====================

1     8     .      .      8     2     7

2     9    1      .      1     9     4

3     7    2      .      7     2     .

4     1    .       .      4     8     1

5     3    2      .      3     2





I need to be able to validate that if a persons answers a number in (V1, V2,
or V3)  then it should appear on any of the variables (X1, X2, or X3),
otherwise there's a problem with the information.



How can I, via syntaxis, validate that every number that appears on (V1, V2,
or V3) must be on any position of  (X1, X2, or X3).



Regards!!!
Reply | Threaded
Open this post in threaded view
|

Re: Validating Multiple Variables

Marks, Jim
Eugenio:

ANY can be use to compare the value in one variable to the values in a
list of variables:

*** sample data.
DATA LIST FREE /id v1 TO v3 x1 TO x3.
BEGIN DATA
1 8 . . 8 2 7
2 9 1 . 1 9 4
3 7 2 . 7 2 .
4 1 . . 4 8 1
5 3 2 . 3 2 .
6 8 6 4 1 3 5
END DATA.

COMPUTE found_v1 = ANY(v1,x1 TO x3).
COMPUTE found_v2 = ANY(v2,x1 TO x3).
COMPUTE found_v3 = ANY(v3,x1 TO x3).
FREQUENCIES found_v1 TO found_v3.

Notice case 6 has no matches-- found_v1 to found_v3 are all 0.
Notice also that cases with no value in v1 to v3 are system missing in
the "found" variables-- case 1 is sysmis in found_v2 and found_v3.

--jim



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Eugenio Grant
Sent: Tuesday, December 05, 2006 9:43 AM
To: [hidden email]
Subject: Validating Multiple Variables

Hi Guys:





I have this situation,



Id   V1   V2   V3   X1  X2   X3

====================

1     8     .      .      8     2     7

2     9    1      .      1     9     4

3     7    2      .      7     2     .

4     1    .       .      4     8     1

5     3    2      .      3     2





I need to be able to validate that if a persons answers a number in (V1,
V2, or V3)  then it should appear on any of the variables (X1, X2, or
X3), otherwise there's a problem with the information.



How can I, via syntaxis, validate that every number that appears on (V1,
V2, or V3) must be on any position of  (X1, X2, or X3).



Regards!!!