Auto-Mark Data Fill

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

Auto-Mark Data Fill

Colin Valdiserri

Hello Everyone,

 

I have a question regarding some help with creating syntax in SPSS to fill a “select one” variable with the response from a “select all that apply” variable IF only ONE response option was selected.  For example…

·         Q1 asks, which of the following reasons do you buy fewer products (Select all that apply)?

·         Q2 asks, which of the following was the primary reason you buy fewer products (Select one)? The response options are populated from what was selected as answers in Q1 and this question was only asked if the respondent selected more than 1 response option in Q1.

 

The problem is that if the respondent only selected one response option from Q1, then Q2 does not have any data and I need to populate the Q2 data with that single response option that was selected.

 

Q1 is set up like a typical “select all that apply” where there are separate variables for each response option coded using “0” and “1”.

 

Thank you to everyone in advance for your help!

 

Colin

 

 

Colin M. Valdiserri

Informed Decisions Group, Inc.

8854 Jordan Court | North Ridgeville, Ohio | 44039
P: 440.935.5414
F: 440.353.0621

cvaldiserri@...
www.idg-consulting.com

 

Follow us on LinkedIn

The information and attachments contained in this e-mail message is intended for the use of the recipient(s) named above and is privileged and confidential. If you are not the intended recipient, you are formally notified that you have received this message in error and that any review, dissemination, distribution, or copying of the message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the original message.

 

Reply | Threaded
Open this post in threaded view
|

Re: Auto-Mark Data Fill

David Marso
Administrator
Hi Colin,
Assume your Q1 variables are called Q1.1, Q1.2,... Q1.10 and are contiguous in the file.
Q2 is missing for the single response.

VECTOR Q=Q1.1 TO Q1.10.
DO IF MISSING(Q2).
+  LOOP #=1 TO 10.
+    IF Q(#)=1 Q2=#.
+  END LOOP.
END IF.

*OR* if your file is HUGE this is likely faster but logically slightly more complex.
VECTOR Q=Q1.1 TO Q1.10.
DO IF MISSING(Q2).
+  LOOP #=1 TO 10.
+    DO IF Q(#)=1.
+      COMPUTE Q2=#.
+      BREAK.
+    END IF.
+  END LOOP.
END IF.

*OR*, you can also use DO REPEAT.  I personally prefer the VECTOR/LOOP/BREAK solution.
DO IF MISSING(Q2).
+  DO REPEAT Q=Q1.1 TO Q1.10 / INDEX=1 TO 10.
+    IF Q=1 Q2=INDEX.
+  END REPEAT.
END IF.

HTH, David
---
Colin Valdiserri wrote
Hello Everyone,



I have a question regarding some help with creating syntax in SPSS to fill a
"select one" variable with the response from a "select all that apply"
variable IF only ONE response option was selected.  For example.

.         Q1 asks, which of the following reasons do you buy fewer products
(Select all that apply)?

.         Q2 asks, which of the following was the primary reason you buy
fewer products (Select one)? The response options are populated from what
was selected as answers in Q1 and this question was only asked if the
respondent selected more than 1 response option in Q1.



The problem is that if the respondent only selected one response option from
Q1, then Q2 does not have any data and I need to populate the Q2 data with
that single response option that was selected.



Q1 is set up like a typical "select all that apply" where there are separate
variables for each response option coded using "0" and "1".



Thank you to everyone in advance for your help!



Colin





Colin M. Valdiserri

Informed Decisions Group, Inc.

8854 Jordan Court | North Ridgeville, Ohio | 44039
P: 440.935.5414
F: 440.353.0621

 <http://[hidden email]>
[hidden email]
 <http://www.idg-consulting.com/> www.idg-consulting.com



Follow us on
<http://www.linkedin.com/company/informed-decisions-group-inc/products>
LinkedIn

The information and attachments contained in this e-mail message is intended
for the use of the recipient(s) named above and is privileged and
confidential. If you are not the intended recipient, you are formally
notified that you have received this message in error and that any review,
dissemination, distribution, or copying of the message is strictly
prohibited. If you have received this communication in error, please notify
us immediately by e-mail and delete the original message.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Auto-Mark Data Fill

Colin Valdiserri
Thank you very much!


Colin M. Valdiserri
Informed Decisions Group, Inc.
8854 Jordan Court | North Ridgeville, Ohio | 44039
P: 440.935.5414
F: 440.353.0621
[hidden email]
www.idg-consulting.com

Follow us on LinkedIn
The information and attachments contained in this e-mail message is intended
for the use of the recipient(s) named above and is privileged and
confidential. If you are not the intended recipient, you are formally
notified that you have received this message in error and that any review,
dissemination, distribution, or copying of the message is strictly
prohibited. If you have received this communication in error, please notify
us immediately by e-mail and delete the original message.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
David Marso
Sent: Thursday, September 08, 2011 12:13 PM
To: [hidden email]
Subject: Re: Auto-Mark Data Fill

Hi Colin,
Assume your Q1 variables are called Q1.1, Q1.2,... Q1.10 and are contiguous
in the file.
Q2 is missing for the single response.

VECTOR Q=Q1.1 TO Q1.10.
DO IF MISSING(Q2).
+  LOOP #=1 TO 10.
+    IF Q(#)=1 Q2=#.
+  END LOOP.
END IF.

*OR* if your file is HUGE this is likely faster but logically slightly more
complex.
VECTOR Q=Q1.1 TO Q1.10.
DO IF MISSING(Q2).
+  LOOP #=1 TO 10.
+    DO IF Q(#)=1.
+      COMPUTE Q2=#.
+      BREAK.
+    END IF.
+  END LOOP.
END IF.

*OR*, you can also use DO REPEAT.  I personally prefer the VECTOR/LOOP/BREAK
solution.
DO IF MISSING(Q2).
+  DO REPEAT Q=Q1.1 TO Q1.10 / INDEX=1 TO 10.
+    IF Q=1 Q2=INDEX.
+  END REPEAT.
END IF.

HTH, David
---

Colin Valdiserri wrote:

>
> Hello Everyone,
>
>
>
> I have a question regarding some help with creating syntax in SPSS to
> fill a "select one" variable with the response from a "select all that
> apply"
> variable IF only ONE response option was selected.  For example.
>
> .         Q1 asks, which of the following reasons do you buy fewer
> products
> (Select all that apply)?
>
> .         Q2 asks, which of the following was the primary reason you buy
> fewer products (Select one)? The response options are populated from
> what was selected as answers in Q1 and this question was only asked if
> the respondent selected more than 1 response option in Q1.
>
>
>
> The problem is that if the respondent only selected one response
> option from Q1, then Q2 does not have any data and I need to populate
> the Q2 data with that single response option that was selected.
>
>
>
> Q1 is set up like a typical "select all that apply" where there are
> separate variables for each response option coded using "0" and "1".
>
>
>
> Thank you to everyone in advance for your help!
>
>
>
> Colin
>
>
>
>
>
> Colin M. Valdiserri
>
> Informed Decisions Group, Inc.
>
> 8854 Jordan Court | North Ridgeville, Ohio | 44039
> P: 440.935.5414
> F: 440.353.0621
>
>
> &lt;http://us.mc8.mail.yahoo.com/mc/compose?to=cvaldiserri@idg-consult
> ing.com&gt;
> [hidden email]
>  &lt;http://www.idg-consulting.com/&gt; www.idg-consulting.com
>
>
>
> Follow us on
> &lt;http://www.linkedin.com/company/informed-decisions-group-inc/produ
> cts&gt;
> LinkedIn
>
> The information and attachments contained in this e-mail message is
> intended for the use of the recipient(s) named above and is privileged
> and confidential. If you are not the intended recipient, you are
> formally notified that you have received this message in error and
> that any review, dissemination, distribution, or copying of the
> message is strictly prohibited. If you have received this
> communication in error, please notify us immediately by e-mail and
> delete the original message.
>


--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Auto-Mark-Data-Fill-tp4782913p
4783028.html
Sent from the SPSSX Discussion mailing list archive at Nabble.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

=====================
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: Auto-Mark Data Fill

David Marso
Administrator
You are very welcome!
The following just occurred to me and is even simpler.
<UNTESTED>
VECTOR Q=Q1.1 TO Q1.10.
DO IF MISSING(Q2).
+  LOOP Q2=1 TO 10.
+  END LOOP IF Q(Q2)=1.
END IF.

Colin Valdiserri wrote
Thank you very much!


Colin M. Valdiserri
Informed Decisions Group, Inc.
8854 Jordan Court | North Ridgeville, Ohio | 44039
P: 440.935.5414
F: 440.353.0621
[hidden email]
www.idg-consulting.com

Follow us on LinkedIn
The information and attachments contained in this e-mail message is intended
for the use of the recipient(s) named above and is privileged and
confidential. If you are not the intended recipient, you are formally
notified that you have received this message in error and that any review,
dissemination, distribution, or copying of the message is strictly
prohibited. If you have received this communication in error, please notify
us immediately by e-mail and delete the original message.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
David Marso
Sent: Thursday, September 08, 2011 12:13 PM
To: [hidden email]
Subject: Re: Auto-Mark Data Fill

Hi Colin,
Assume your Q1 variables are called Q1.1, Q1.2,... Q1.10 and are contiguous
in the file.
Q2 is missing for the single response.

VECTOR Q=Q1.1 TO Q1.10.
DO IF MISSING(Q2).
+  LOOP #=1 TO 10.
+    IF Q(#)=1 Q2=#.
+  END LOOP.
END IF.

*OR* if your file is HUGE this is likely faster but logically slightly more
complex.
VECTOR Q=Q1.1 TO Q1.10.
DO IF MISSING(Q2).
+  LOOP #=1 TO 10.
+    DO IF Q(#)=1.
+      COMPUTE Q2=#.
+      BREAK.
+    END IF.
+  END LOOP.
END IF.

*OR*, you can also use DO REPEAT.  I personally prefer the VECTOR/LOOP/BREAK
solution.
DO IF MISSING(Q2).
+  DO REPEAT Q=Q1.1 TO Q1.10 / INDEX=1 TO 10.
+    IF Q=1 Q2=INDEX.
+  END REPEAT.
END IF.

HTH, David
---

Colin Valdiserri wrote:
>
> Hello Everyone,
>
>
>
> I have a question regarding some help with creating syntax in SPSS to
> fill a "select one" variable with the response from a "select all that
> apply"
> variable IF only ONE response option was selected.  For example.
>
> .         Q1 asks, which of the following reasons do you buy fewer
> products
> (Select all that apply)?
>
> .         Q2 asks, which of the following was the primary reason you buy
> fewer products (Select one)? The response options are populated from
> what was selected as answers in Q1 and this question was only asked if
> the respondent selected more than 1 response option in Q1.
>
>
>
> The problem is that if the respondent only selected one response
> option from Q1, then Q2 does not have any data and I need to populate
> the Q2 data with that single response option that was selected.
>
>
>
> Q1 is set up like a typical "select all that apply" where there are
> separate variables for each response option coded using "0" and "1".
>
>
>
> Thank you to everyone in advance for your help!
>
>
>
> Colin
>
>
>
>
>
> Colin M. Valdiserri
>
> Informed Decisions Group, Inc.
>
> 8854 Jordan Court | North Ridgeville, Ohio | 44039
> P: 440.935.5414
> F: 440.353.0621
>
>
> <http://us.mc8.mail.yahoo.com/mc/compose?to=cvaldiserri@idg-consult
> ing.com>
> [hidden email]
>  <http://www.idg-consulting.com/> www.idg-consulting.com
>
>
>
> Follow us on
> <http://www.linkedin.com/company/informed-decisions-group-inc/produ
> cts>
> LinkedIn
>
> The information and attachments contained in this e-mail message is
> intended for the use of the recipient(s) named above and is privileged
> and confidential. If you are not the intended recipient, you are
> formally notified that you have received this message in error and
> that any review, dissemination, distribution, or copying of the
> message is strictly prohibited. If you have received this
> communication in error, please notify us immediately by e-mail and
> delete the original message.
>


--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Auto-Mark-Data-Fill-tp4782913p
4783028.html
Sent from the SPSSX Discussion mailing list archive at Nabble.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

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Auto-Mark Data Fill

Art Kendall
In reply to this post by Colin Valdiserri
see if this does what you are looking for.

data list list/ id(f2) q1.1 to q1.5 (5f1) q2 (f1).
begin data
    01 1 0 0 0 0 0
    02 0 1 1 1 1 0
    03 0 1 0 0 0 0
    04 1 1 1 1 1 3
    05 1 0 1 0 1 5
end data.
missing values q2 (0).
compute nchecked = sum(q1.1 to q1.5).
do if missing(q2).
    do if nchecked eq 1.
        do repeat index = 1 to 5 /q = q1.1 to q1.5.
            if q eq 1 q2a= index.
        end repeat.
        ELSE.
        compute q2a = 0.
    end if.
    ELSE.
    compute q2a=q2.
end if.
formats nchecked q2a (f1).
missing values q2a (0).
list.

Art Kendall
Social Research Consultants

On 9/8/2011 11:30 AM, Colin Valdiserri wrote:

Hello Everyone,

 

I have a question regarding some help with creating syntax in SPSS to fill a “select one” variable with the response from a “select all that apply” variable IF only ONE response option was selected.  For example…

·         Q1 asks, which of the following reasons do you buy fewer products (Select all that apply)?

·         Q2 asks, which of the following was the primary reason you buy fewer products (Select one)? The response options are populated from what was selected as answers in Q1 and this question was only asked if the respondent selected more than 1 response option in Q1.

 

The problem is that if the respondent only selected one response option from Q1, then Q2 does not have any data and I need to populate the Q2 data with that single response option that was selected.

 

Q1 is set up like a typical “select all that apply” where there are separate variables for each response option coded using “0” and “1”.

 

Thank you to everyone in advance for your help!

 

Colin

 

 

Colin M. Valdiserri

Informed Decisions Group, Inc.

8854 Jordan Court | North Ridgeville, Ohio | 44039
P: 440.935.5414
F: 440.353.0621

cvaldiserri@...
www.idg-consulting.com

 

Follow us on LinkedIn

The information and attachments contained in this e-mail message is intended for the use of the recipient(s) named above and is privileged and confidential. If you are not the intended recipient, you are formally notified that you have received this message in error and that any review, dissemination, distribution, or copying of the message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the original message.

 

===================== 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
Art Kendall
Social Research Consultants