Compute new variable

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

Compute new variable

Darren Philpott






Hi

 

I have a data set containing candidate responses to a test.  The responses are numeric (1-5).  Each candidate represents a case and the responses to each test question are variables 1 - 30.

 

I need to compute a new variable to flag candidates who have responded with the same answer too many times in a row e.g.

 

For example if a candidate responds with the same answer 6 times (e.g. 3,3,3,3,3,3) in a row anywhere within the 30 questions a 'flag' variable should be created with a value of 1.

 

Any ideas on how I can compute this variable would be appreciated, syntax is very welcome.

 

Thanks,

Darren

 

 

 

 

 


_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.verizonbusiness.com/uk
Reply | Threaded
Open this post in threaded view
|

Re: Compute new variable

Albert-Jan Roskam
Hi,

COUNT does wat you want:
countvar = count v1 to v6 (3).

You can recode it to make countvar binary, of course.

Cheers!!
Albert-Jan


--- On Mon, 3/30/09, Darren Philpott <[hidden email]> wrote:

> From: Darren Philpott <[hidden email]>
> Subject: Compute new variable
> To: [hidden email]
> Date: Monday, March 30, 2009, 12:16 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>   Hi
>
>
>   I
> have a data set
>   containing candidate responses to a test.  The
> responses
>   are numeric (1-5).  Each candidate represents a
> case and the
>   responses to each test question are variables 1 -
> 30.
>
>
>   I
> need to compute a
>   new variable to flag candidates who have responded with
> the same answer too
>   many times in a row e.g.
>
>
>
>   For
> example if a
>   candidate responds with the same answer 6 times (e.g.
> 3,3,3,3,3,3) in a row
>   anywhere within the 30 questions a
> 'flag' variable should be created
>   with a value of 1.
>
>
>
>   Any
> ideas on how I
>   can compute this variable would be appreciated, syntax is
> very welcome.
>
>
>   Thanks,
>
>   Darren
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _____________________________________________________________________
>
> This e-mail has been scanned for viruses by Verizon
> Business Internet Managed Scanning Services - powered by
> MessageLabs. For further information visit
> http://www.verizonbusiness.com/uk
>
>
>
>
>

=====================
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: Compute new variable

Darren Philpott
Thanks, but...

I'm not sure this is the best way to do this though.

I need to do the following

Each variable is a response to a question.  Each response can be a value between 0 and 6.  I need to flag instances where candidates respond to 6 or more questions in sequence with the same answer eg.

1       2       3       4       5       5       5       5       5       5       5       6       1       0

To use count would you not need to count variables 1 - 6 that equal 0 then repeat for these variables but counting those that equal 1, 2, 3, 4, 5, 6?  The repeat the steps for items 2-7 and so on..

Cheers,
Darren

-----Original Message-----
From: Albert-jan Roskam [mailto:[hidden email]]
Sent: 30 March 2009 11:26
To: [hidden email]; Darren Philpott
Subject: Re: Compute new variable


Hi,

COUNT does wat you want:
countvar = count v1 to v6 (3).

You can recode it to make countvar binary, of course.

Cheers!!
Albert-Jan


--- On Mon, 3/30/09, Darren Philpott <[hidden email]> wrote:

> From: Darren Philpott <[hidden email]>
> Subject: Compute new variable
> To: [hidden email]
> Date: Monday, March 30, 2009, 12:16 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>   Hi
>
>
>   I
> have a data set
>   containing candidate responses to a test.  The
> responses
>   are numeric (1-5).  Each candidate represents a
> case and the
>   responses to each test question are variables 1 -
> 30.
>
>
>   I
> need to compute a
>   new variable to flag candidates who have responded with
> the same answer too
>   many times in a row e.g.
>
>
>
>   For
> example if a
>   candidate responds with the same answer 6 times (e.g.
> 3,3,3,3,3,3) in a row
>   anywhere within the 30 questions a
> 'flag' variable should be created
>   with a value of 1.
>
>
>
>   Any
> ideas on how I
>   can compute this variable would be appreciated, syntax is
> very welcome.
>
>
>   Thanks,
>
>   Darren
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _____________________________________________________________________
>
> This e-mail has been scanned for viruses by Verizon
> Business Internet Managed Scanning Services - powered by
> MessageLabs. For further information visit
> http://www.verizonbusiness.com/uk
>
>
>
>
>




_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.verizonbusiness.com/uk

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.11.31/2029 - Release Date: 03/29/09 16:56:00

_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.verizonbusiness.com/uk

=====================
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: Compute new variable

Albert-Jan Roskam
In reply to this post by Darren Philpott
Hi again,

Maybe this works, but double-check if you get the desired results in case there are missing values.

do repeat #var = var1 to var6 / #value = 1 to 6 / #cntvar = #cntvar1 to #cntvar6.
#cntvar = COUNT #var (#value).
end repeat print.
compute maxcnt = max (#cntvar1 to #cntvar6).
exe.

Cheers!!
Albert-Jan


--- On Mon, 3/30/09, Darren Philpott <[hidden email]> wrote:

> From: Darren Philpott <[hidden email]>
> Subject: RE: Compute new variable
> To: "Albert-jan Roskam" <[hidden email]>, "[hidden email]" <[hidden email]>
> Date: Monday, March 30, 2009, 3:47 PM
> Thanks, but...
>
> I'm not sure this is the best way to do this though.
>
> I need to do the following
>
> Each variable is a response to a question.  Each
> response can be a value between 0 and 6.  I need to
> flag instances where candidates respond to 6 or more
> questions in sequence with the same answer eg.
>
> 1    2    3
> 4    5    5
> 5    5    5
> 5    5    6
> 1    0
>
> To use count would you not need to count variables 1 - 6
> that equal 0 then repeat for these variables but counting
> those that equal 1, 2, 3, 4, 5, 6?  The repeat the
> steps for items 2-7 and so on..
>
> Cheers,
> Darren
>
> -----Original Message-----
> From: Albert-jan Roskam [mailto:[hidden email]]
> Sent: 30 March 2009 11:26
> To: [hidden email];
> Darren Philpott
> Subject: Re: Compute new variable
>
>
> Hi,
>
> COUNT does wat you want:
> countvar = count v1 to v6 (3).
>
> You can recode it to make countvar binary, of course.
>
> Cheers!!
> Albert-Jan
>
>
> --- On Mon, 3/30/09, Darren Philpott <[hidden email]>
> wrote:
>
> > From: Darren Philpott <[hidden email]>
> > Subject: Compute new variable
> > To: [hidden email]
> > Date: Monday, March 30, 2009, 12:16 PM
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >   Hi
> >
> >
> >   I
> > have a data set
> >   containing candidate responses to a
> test.  The
> > responses
> >   are numeric (1-5).  Each candidate
> represents a
> > case and the
> >   responses to each test question are
> variables 1 -
> > 30.
> >
> >
> >   I
> > need to compute a
> >   new variable to flag candidates who
> have responded with
> > the same answer too
> >   many times in a row e.g.
> >
> >
> >
> >   For
> > example if a
> >   candidate responds with the same
> answer 6 times (e.g.
> > 3,3,3,3,3,3) in a row
> >   anywhere within the 30 questions a
> > 'flag' variable should be created
> >   with a value of 1.
> >
> >
> >
> >   Any
> > ideas on how I
> >   can compute this variable would be
> appreciated, syntax is
> > very welcome.
> >
> >
> >   Thanks,
> >
> >   Darren
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> _____________________________________________________________________
> >
> > This e-mail has been scanned for viruses by Verizon
> > Business Internet Managed Scanning Services - powered
> by
> > MessageLabs. For further information visit
> > http://www.verizonbusiness.com/uk
> >
> >
> >
> >
> >
>
>
>
>
> _____________________________________________________________________
> This e-mail has been scanned for viruses by Verizon
> Business Internet Managed Scanning Services - powered by
> MessageLabs. For further information visit http://www.verizonbusiness.com/uk
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.0.238 / Virus Database: 270.11.31/2029 - Release
> Date: 03/29/09 16:56:00
>
> _____________________________________________________________________
> This e-mail has been scanned for viruses by Verizon
> Business Internet Managed Scanning Services - powered by
> MessageLabs. For further information visit http://www.verizonbusiness.com/uk
>

=====================
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: Compute new variable

Gyorgy Bea
In reply to this post by Darren Philpott

Hi Darren,

The following (variable "flag") will count the straight liners, those cases, when the candidate responds with the same answer to at least 6 consecutive questions, like in your example.

vector v=v1 to v30.
compute #x=v(1).
compute #nr=1.
loop #i=1 to 30.
   do if v(#i)=#x.
      compute #nr=#nr+1.
      do if #nr=6.
         compute flag=1.
         BREAK.
      end if.
   else.
      compute #x=v(#i).
      compute #nr=1.
   end if.
end loop.


Let me know if it works. :-)

Regards,
Beata


From: Darren Philpott <[hidden email]>
To: [hidden email]
Sent: Monday, March 30, 2009 4:47:57 PM
Subject: Re: Compute new variable

Thanks, but...

I'm not sure this is the best way to do this though.

I need to do the following

Each variable is a response to a question.  Each response can be a value between 0 and 6.  I need to flag instances where candidates respond to 6 or more questions in sequence with the same answer eg.

1      2      3      4      5      5      5      5      5      5      5      6      1      0

To use count would you not need to count variables 1 - 6 that equal 0 then repeat for these variables but counting those that equal 1, 2, 3, 4, 5, 6?  The repeat the steps for items 2-7 and so on..

Cheers,
Darren

-----Original Message-----
From: Albert-jan Roskam [mailto:[hidden email]]
Sent: 30 March 2009 11:26
To: [hidden email]; Darren Philpott
Subject: Re: Compute new variable


Hi,

COUNT does wat you want:
countvar = count v1 to v6 (3).

You can recode it to make countvar binary, of course.

Cheers!!
Albert-Jan


--- On Mon, 3/30/09, Darren Philpott <[hidden email]> wrote:

> From: Darren Philpott <[hidden email]>
> Subject: Compute new variable
> To: [hidden email]
> Date: Monday, March 30, 2009, 12:16 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  Hi
>
>
>  I
> have a data set
>  containing candidate responses to a test.  The
> responses
>  are numeric (1-5).  Each candidate represents a
> case and the
>  responses to each test question are variables 1 -
> 30.
>
>
>  I
> need to compute a
>  new variable to flag candidates who have responded with
> the same answer too
>  many times in a row e.g.
>
>
>
>  For
> example if a
>  candidate responds with the same answer 6 times (e.g.
> 3,3,3,3,3,3) in a row
>  anywhere within the 30 questions a
> 'flag' variable should be created
>  with a value of 1.
>
>
>
>  Any
> ideas on how I
>  can compute this variable would be appreciated, syntax is
> very welcome.
>
>
>  Thanks,
>
>  Darren
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _____________________________________________________________________
>
> This e-mail has been scanned for viruses by Verizon
> Business Internet Managed Scanning Services - powered by
> MessageLabs. For further information visit
> http://www.verizonbusiness.com/uk
>
>
>
>
>




_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.verizonbusiness.com/uk

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.11.31/2029 - Release Date: 03/29/09 16:56:00

_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.verizonbusiness.com/uk

=====================
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
Hi Darren,


Reply | Threaded
Open this post in threaded view
|

Re: Compute new variable

Garry Gelade
In reply to this post by Darren Philpott
Hi Darren

I don't think  COUNT will work for you anyway because it won't distinguish
between variables in sequence (eg 5 5 5) and variables not in sequence eg (5
5 3 5).

I think what you need to do is to restructure your file. Ensure each case
has a unique id, and using this id as the case identification variable,
convert the variables to cases.  On the restructured file use lag functions
to detect your sequences and flag them. Something like:

Compute flag = 0.
If (var = lag(var,1) & var = lag(var,2) & ....lag(var,5)) flag = 1.


Then aggregate flag (e.g. /sum_flag = sum(flag)) by id. Merge the aggregated
file (add variables) back with your original file. Anything with a sum_flag
gretaer than 0 is a case with 6 or more variables in sequence.

Garry Gelade
Business Analytic Ltd.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Darren Philpott
Sent: 30 March 2009 14:48
To: [hidden email]
Subject: Re: Compute new variable

Thanks, but...

I'm not sure this is the best way to do this though.

I need to do the following

Each variable is a response to a question.  Each response can be a value
between 0 and 6.  I need to flag instances where candidates respond to 6 or
more questions in sequence with the same answer eg.

1       2       3       4       5       5       5       5       5       5
5       6       1       0

To use count would you not need to count variables 1 - 6 that equal 0 then
repeat for these variables but counting those that equal 1, 2, 3, 4, 5, 6?
The repeat the steps for items 2-7 and so on..

Cheers,
Darren

-----Original Message-----
From: Albert-jan Roskam [mailto:[hidden email]]
Sent: 30 March 2009 11:26
To: [hidden email]; Darren Philpott
Subject: Re: Compute new variable


Hi,

COUNT does wat you want:
countvar = count v1 to v6 (3).

You can recode it to make countvar binary, of course.

Cheers!!
Albert-Jan


--- On Mon, 3/30/09, Darren Philpott <[hidden email]> wrote:

> From: Darren Philpott <[hidden email]>
> Subject: Compute new variable
> To: [hidden email]
> Date: Monday, March 30, 2009, 12:16 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>   Hi
>
>
>   I
> have a data set
>   containing candidate responses to a test.  The responses
>   are numeric (1-5).  Each candidate represents a case and the
>   responses to each test question are variables 1 - 30.
>
>
>   I
> need to compute a
>   new variable to flag candidates who have responded with the same
> answer too
>   many times in a row e.g.
>
>
>
>   For
> example if a
>   candidate responds with the same answer 6 times (e.g.
> 3,3,3,3,3,3) in a row
>   anywhere within the 30 questions a
> 'flag' variable should be created
>   with a value of 1.
>
>
>
>   Any
> ideas on how I
>   can compute this variable would be appreciated, syntax is very
> welcome.
>
>
>   Thanks,
>
>   Darren
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _____________________________________________________________________
>
> This e-mail has been scanned for viruses by Verizon Business Internet
> Managed Scanning Services - powered by MessageLabs. For further
> information visit http://www.verizonbusiness.com/uk
>
>
>
>
>




_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet
Managed Scanning Services - powered by MessageLabs. For further information
visit http://www.verizonbusiness.com/uk

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.11.31/2029 - Release Date: 03/29/09
16:56:00

_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet
Managed Scanning Services - powered by MessageLabs. For further information
visit http://www.verizonbusiness.com/uk

=====================
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

__________ NOD32 3974 (20090330) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com

=====================
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: Compute new variable

Maguin, Eugene
In reply to this post by Darren Philpott
Darren,

I think you need to use a loop structure. I don't think you can restructure
your data set and use aggregate. The key element is to compare the current
value against the previous value and increment a counter if the two are the
same. If they are not the counter gets reset. Something like this but it's
untested and I don't have time to work out the details. And one important
detail is missing values. But that also depends on how you have missing
values represented. Sysmis will be a bad choice here.

Vector x=x1 to x14.
Compute pick=0.
Compute #count=0.
Loop #i=2 to 14.
+  do if (x(#i) eq x(#i-1)).
+     compute #count=#count+1.
+     do if (#count eq 6).
+        compute pick=1.
+        break.
+     end if.
+  else.
+     compute #count=0.
+  end if.
End loop.

Gene Maguin


>>Thanks, but...

I'm not sure this is the best way to do this though.

I need to do the following

Each variable is a response to a question.  Each response can be a value
between 0 and 6.  I need to flag instances where candidates respond to 6 or
more questions in sequence with the same answer eg.

1       2       3       4       5       5       5       5       5       5
5       6       1       0

To use count would you not need to count variables 1 - 6 that equal 0 then
repeat for these variables but counting those that equal 1, 2, 3, 4, 5, 6?
The repeat the steps for items 2-7 and so on..

Cheers,
Darren

-----Original Message-----
From: Albert-jan Roskam [mailto:[hidden email]]
Sent: 30 March 2009 11:26
To: [hidden email]; Darren Philpott
Subject: Re: Compute new variable


Hi,

COUNT does wat you want:
countvar = count v1 to v6 (3).

You can recode it to make countvar binary, of course.

Cheers!!
Albert-Jan


--- On Mon, 3/30/09, Darren Philpott <[hidden email]> wrote:

> From: Darren Philpott <[hidden email]>
> Subject: Compute new variable
> To: [hidden email]
> Date: Monday, March 30, 2009, 12:16 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>   Hi
>
>
>   I
> have a data set
>   containing candidate responses to a test.  The
> responses
>   are numeric (1-5).  Each candidate represents a
> case and the
>   responses to each test question are variables 1 -
> 30.
>
>
>   I
> need to compute a
>   new variable to flag candidates who have responded with
> the same answer too
>   many times in a row e.g.
>
>
>
>   For
> example if a
>   candidate responds with the same answer 6 times (e.g.
> 3,3,3,3,3,3) in a row
>   anywhere within the 30 questions a
> 'flag' variable should be created
>   with a value of 1.
>
>
>
>   Any
> ideas on how I
>   can compute this variable would be appreciated, syntax is
> very welcome.
>
>
>   Thanks,
>
>   Darren
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _____________________________________________________________________
>
> This e-mail has been scanned for viruses by Verizon
> Business Internet Managed Scanning Services - powered by
> MessageLabs. For further information visit
> http://www.verizonbusiness.com/uk
>
>
>
>
>




_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet
Managed Scanning Services - powered by MessageLabs. For further information
visit http://www.verizonbusiness.com/uk

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.11.31/2029 - Release Date: 03/29/09
16:56:00

_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet
Managed Scanning Services - powered by MessageLabs. For further information
visit http://www.verizonbusiness.com/uk

=====================
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

=====================
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: Compute new variable

Gyorgy Bea
In reply to this post by Darren Philpott
Actually the loop should begin at 2.


From: Gyorgy Bea <[hidden email]>
To: [hidden email]
Sent: Monday, March 30, 2009 5:21:53 PM
Subject: Re: Compute new variable


Hi Darren,

The following (variable "flag") will count the straight liners, those cases, when the candidate responds with the same answer to at least 6 consecutive questions, like in your example.

vector v=v1 to v30.
compute #x=v(1).
compute #nr=1.
loop #i=2 to 30.
   do if v(#i)=#x.
      compute #nr=#nr+1.
      do if #nr=6.
         compute flag=1.
         BREAK.
      end if.
   else.
      compute #x=v(#i).
      compute #nr=1.
   end if.
end loop.


Let me know if it works. :-)

Regards,
Beata


From: Darren Philpott <[hidden email]>
To: [hidden email]
Sent: Monday, March 30, 2009 4:47:57 PM
Subject: Re: Compute new variable

Thanks, but...

I'm not sure this is the best way to do this though.

I need to do the following

Each variable is a response to a question.  Each response can be a value between 0 and 6.  I need to flag instances where candidates respond to 6 or more questions in sequence with the same answer eg.

1      2      3      4      5      5      5      5      5      5      5      6      1      0

To use count would you not need to count variables 1 - 6 that equal 0 then repeat for these variables but counting those that equal 1, 2, 3, 4, 5, 6?  The repeat the steps for items 2-7 and so on..

Cheers,
Darren

-----Original Message-----
From: Albert-jan Roskam [mailto:[hidden email]]
Sent: 30 March 2009 11:26
To: [hidden email]; Darren Philpott
Subject: Re: Compute new variable


Hi,

COUNT does wat you want:
countvar = count v1 to v6 (3).

You can recode it to make countvar binary, of course.

Cheers!!
Albert-Jan


--- On Mon, 3/30/09, Darren Philpott <[hidden email]> wrote:

> From: Darren Philpott <[hidden email]>
> Subject: Compute new variable
> To: [hidden email]
> Date: Monday, March 30, 2009, 12:16 PM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  Hi
>
>
>  I
> have a data set
>  containing candidate responses to a test.  The
> responses
>  are numeric (1-5).  Each candidate represents a
> case and the
>  responses to each test question are variables 1 -
> 30.
>
>
>  I
> need to compute a
>  new variable to flag candidates who have responded with
> the same answer too
>  many times in a row e.g.
>
>
>
>  For
> example if a
>  candidate responds with the same answer 6 times (e.g.
> 3,3,3,3,3,3) in a row
>  anywhere within the 30 questions a
> 'flag' variable should be created
>  with a value of 1.
>
>
>
>  Any
> ideas on how I
>  can compute this variable would be appreciated, syntax is
> very welcome.
>
>
>  Thanks,
>
>  Darren
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _____________________________________________________________________
>
> This e-mail has been scanned for viruses by Verizon
> Business Internet Managed Scanning Services - powered by
> MessageLabs. For further information visit
> http://www.verizonbusiness.com/uk
>
>
>
>
>




_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.verizonbusiness.com/uk

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.11.31/2029 - Release Date: 03/29/09 16:56:00

_____________________________________________________________________
This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.verizonbusiness.com/uk

=====================
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
Hi Darren,