Combining Variables--Defining Vector

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Combining Variables--Defining Vector

Glenys Lafrance
Hi,

This is the first time I have used syntax...so pls excuse my lack of
sophistication.  I am hoping someone can help me to get this command to
work.  I have lots of combining of variables to do and don't want to waste
time rearranging the data columns.  I "lifted" this from the archives and
adjusted it for my purpose...but I don't really understand how each part of
the command works.  I have defined a vector of contiguous variables.  There
are 6 variables in the vector.  But in this instance I only want to combine
5 of the 6 variables to form a new variable.  The variable that is left out
happens to be in the middle of the vector.  I have specified the 5
variables to be combined on Line 1 and Line 14 (count #resps).  I'd
appreciate help refining this if it is possible to do so.

Second question.  How would I write the syntax if I wanted to exclude a
variable within the vector and treat it as sysmis?

Third question.  How do I include a command that names the new variable.
At the moment when it the syntax runs, the new variable is named ENTERED.
If I want to run several variations of this command I need unique names for
each, or only the first one will run, the others give error messages.

Many thanks.

Glenys Lafrance

MISSING VALUES q29a3 q29a5 q29a6 q29a7 q29a8 (9).

NUMERIC ENTERED (F2).
VAR LABELS ENTERED 'Level2D Within Internal Board'.
VAL LABELS ENTERED
 0 'none'
 1 'student'
 2 'faculty'
 3 'support'
 4 'administration'
 5 'president'
6 'multi' .
VECTOR RESPVAR = q29a3 to q29a8 .
COMPUTE ENTERED = 0.
COUNT #RESPS = q29a3 q29a5 q29a6 q29a7 q29a8 (0) .
DO IF #RESPS GT 1.
. COMPUTE ENTERED = 6.
ELSE.
- LOOP #RESPIDX = 0 TO 5.
. IF (RESPVAR(#RESPIDX) EQ 0) ENTERED = #RESPIDX.
- END LOOP.
END IF.

LIST.