Split file according to 3 string questions

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

Split file according to 3 string questions

Aenni
Dear Team

I would love to get your advice on this issue.

I have data from a 2x2x3 experiment.
For this dataset I have 3 manipulation questions. I created three embedded data fields in the survey for these questions with the labels "Correct" and "Wrong".

Now, I would like to split my file in four versions to see if answering the 3 manipulation questions has an influence on my outcome.

To capture the correct/ wrong manipulation questions (ResponseReason, Attribution, Measure), I tried to create a filter variable - without success.
Perhaps someone could share some expertise about this issue and how to proceed.

Thanks so much!
Anna

My code for the filter varibale:

Do if (ResponseAttribution = "Correct" and ResponseMeasure = "Correct" and ResponseReason = "Correct").
FilterVar = 3.
ELSE if ((ResponseAttribution = "Correct" and ResponseMeasure = "Correct") or (ResponseAttribution = "Correct" and ResponseReason = "Correct") or (ResponseMeasure = "Correct" and ResponseReason = "Correct")).
FilterVar = 2.
Else if ResponseAttribution = "Correct" or ResponseMeasure = "Correct" or ResponseReason = "Correct".
FilterVar = 1.
else.
FilterVar = 0.
end if.
EXECUTE.
Reply | Threaded
Open this post in threaded view
|

Re: Split file according to 3 string questions

Bruce Weaver
Administrator
It looks like you're just counting the number of "Correct" responses.  If so, you can do it a lot more simply with the COUNT command.  

* Generate some data to illustrate.
DATA LIST LIST /  ResponseAttribution ResponseMeasure ResponseReason (3A10).
BEGIN DATA
"Incorrect" "Incorrect" "Incorrect"
"Correct" "Incorrect" "Incorrect"
"Incorrect" "Correct" "Incorrect"
"Incorrect" "Incorrect" "Correct"
"Correct" "Correct" "Incorrect"
"Correct" "Incorrect" "Correct"
"Incorrect" "Correct" "Correct"
"Correct" "Correct" "Correct"
END DATA.

COUNT FilterVar = ResponseAttribution ResponseMeasure ResponseReason ("Correct").
FORMATS FilterVar(F1).
LIST.


Aenni wrote
Dear Team

I would love to get your advice on this issue.

I have data from a 2x2x3 experiment.
For this dataset I have 3 manipulation questions. I created three embedded data fields in the survey for these questions with the labels "Correct" and "Wrong".

Now, I would like to split my file in four versions to see if answering the 3 manipulation questions has an influence on my outcome.

To capture the correct/ wrong manipulation questions (ResponseReason, Attribution, Measure), I tried to create a filter variable - without success.
Perhaps someone could share some expertise about this issue and how to proceed.

Thanks so much!
Anna

My code for the filter varibale:

Do if (ResponseAttribution = "Correct" and ResponseMeasure = "Correct" and ResponseReason = "Correct").
FilterVar = 3.
ELSE if ((ResponseAttribution = "Correct" and ResponseMeasure = "Correct") or (ResponseAttribution = "Correct" and ResponseReason = "Correct") or (ResponseMeasure = "Correct" and ResponseReason = "Correct")).
FilterVar = 2.
Else if ResponseAttribution = "Correct" or ResponseMeasure = "Correct" or ResponseReason = "Correct".
FilterVar = 1.
else.
FilterVar = 0.
end if.
EXECUTE.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Split file according to 3 string questions

Aenni
Hi Bruce
Many thanks!
It's not really summing up the correct/ wrong answers. I would like to compare my results with "split file" when **at least** 1 (2, all) question(s) is(are) answered correctly.
So I need to somehow capture all cases in which all (two and one) manipulation check question have been correctly answered to see calculate the results when at least one manipulation check question is answered right and so on.
Reply | Threaded
Open this post in threaded view
|

Re: Split file according to 3 string questions

Bruce Weaver
Administrator
In order to fix your original code, you need to add COMPUTE commands, as shown below.

Do if (ResponseAttribution = "Correct" and ResponseMeasure = "Correct" and ResponseReason = "Correct").
COMPUTE FilterVar = 3.
ELSE if ((ResponseAttribution = "Correct" and ResponseMeasure = "Correct") or (ResponseAttribution = "Correct" and ResponseReason = "Correct") or (ResponseMeasure = "Correct" and ResponseReason = "Correct")).
COMPUTE FilterVar = 2.
Else if ResponseAttribution = "Correct" or ResponseMeasure = "Correct" or ResponseReason = "Correct".
COMPUTE FilterVar = 1.
else.
COMPUTE FilterVar = 0.
end if.
EXECUTE.

But notice that your code and my COUNT method yield exactly the same results.

* Generate some data to illustrate.
DATA LIST LIST /  ResponseAttribution ResponseMeasure ResponseReason (3A10).
BEGIN DATA
"Incorrect" "Incorrect" "Incorrect"
"Correct" "Incorrect" "Incorrect"
"Incorrect" "Correct" "Incorrect"
"Incorrect" "Incorrect" "Correct"
"Correct" "Correct" "Incorrect"
"Correct" "Incorrect" "Correct"
"Incorrect" "Correct" "Correct"
"Correct" "Correct" "Correct"
END DATA.

Do if (ResponseAttribution = "Correct" and ResponseMeasure = "Correct" and ResponseReason = "Correct").
COMPUTE FilterVar = 3.
ELSE if ((ResponseAttribution = "Correct" and ResponseMeasure = "Correct") or (ResponseAttribution = "Correct" and ResponseReason = "Correct") or (ResponseMeasure = "Correct" and ResponseReason = "Correct")).
COMPUTE FilterVar = 2.
Else if ResponseAttribution = "Correct" or ResponseMeasure = "Correct" or ResponseReason = "Correct".
COMPUTE FilterVar = 1.
else.
COMPUTE FilterVar = 0.
end if.
EXECUTE.

COUNT FilterVar2 = ResponseAttribution ResponseMeasure ResponseReason ("Correct").
FORMATS FilterVar FilterVar2(F1).
LIST.

OUTPUT:

ResponseAttribution ResponseMeasure ResponseReason FilterVar FilterVar2
 
Incorrect           Incorrect       Incorrect          0          0
Correct             Incorrect       Incorrect          1          1
Incorrect           Correct         Incorrect          1          1
Incorrect           Incorrect       Correct            1          1
Correct             Correct         Incorrect          2          2
Correct             Incorrect       Correct            2          2
Incorrect           Correct         Correct            2          2
Correct             Correct         Correct            3          3
 
Number of cases read:  8    Number of cases listed:  8


So if my COUNT method is not giving the result what you want, neither is your original code.


Aenni wrote
Hi Bruce
Many thanks!
It's not really summing up the correct/ wrong answers. I would like to compare my results with "split file" when **at least** 1 (2, all) question(s) is(are) answered correctly.
So I need to somehow capture all cases in which all (two and one) manipulation check question have been correctly answered to see calculate the results when at least one manipulation check question is answered right and so on.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Split file according to 3 string questions

Bruce Weaver
Administrator
In reply to this post by Aenni
Is this what you're trying to do?

COUNT NumCorrect = ResponseAttribution ResponseMeasure ResponseReason ("Correct").
COMPUTE atleast1 = NumCorrect GT 0.
COMPUTE atleast2 = NumCorrect GT 1.
COMPUTE atleast3 = NumCorrect GT 2.
FORMATS NumCorrect atleast1 to atleast3 (F1).
CROSSTABS
 /TABLES = NumCorrect by atleast1 to atleast3
 /TABLES = atleast1 by atleast2 atleast3
 /TABLES = atleast2 by atleast3.


Aenni wrote
Hi Bruce
Many thanks!
It's not really summing up the correct/ wrong answers. I would like to compare my results with "split file" when **at least** 1 (2, all) question(s) is(are) answered correctly.
So I need to somehow capture all cases in which all (two and one) manipulation check question have been correctly answered to see calculate the results when at least one manipulation check question is answered right and so on.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Split file according to 3 string questions

Aenni
Hi Bruce

Thanks so much for your support! I really appreciate it!

I guess I have to model different variables to capture it. But I'm not quite sure.
I would like to show
for 0 (or any other number/ string): when I have no restriction about correct/ wrong questions --> include all cases
for 1: when at least 1 question is correct --> include cases with 1,2,3 correct questions
for 2: when at least 2 questions are correct --> include cases with 2,3 correct questions
for 3: when all 3 questions are correct --> include only those cases in which all 3 questions are correctly answered

Does this make sense?
Reply | Threaded
Open this post in threaded view
|

Re: Split file according to 3 string questions

Bruce Weaver
Administrator
If there are several things you want to do under each of those conditions, you could stick the basic code in a separate syntax file, and then run it multiple times via INCLUDE FILE.  E.g., if the basic syntax is in file BasicSyntax.sps:  

USE ALL.
FILTER OFF.
INCLUDE FILE = "BasicSyntax.sps".

USE ALL.
FILTER BY atleast1.
INCLUDE FILE = "BasicSyntax.sps".

USE ALL.
FILTER BY atleast2.
INCLUDE FILE = "BasicSyntax.sps".

USE ALL.
FILTER BY atleast3.
INCLUDE FILE = "BasicSyntax.sps".


You cannot simply use SPLIT FILE (as you suggested previously), because your filtering categories are not mutually exclusive.

Aenni wrote
Hi Bruce

Thanks so much for your support! I really appreciate it!

I guess I have to model different variables to capture it. But I'm not quite sure.
I would like to show
for 0 (or any other number/ string): when I have no restriction about correct/ wrong questions --> include all cases
for 1: when at least 1 question is correct --> include cases with 1,2,3 correct questions
for 2: when at least 2 questions are correct --> include cases with 2,3 correct questions
for 3: when all 3 questions are correct --> include only those cases in which all 3 questions are correctly answered

Does this make sense?
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Split file according to 3 string questions

Jon Peck
But please use INSERT rather than the obsolete INCLUDE.

On Tue, Jul 18, 2017 at 6:34 PM, Bruce Weaver <[hidden email]> wrote:
If there are several things you want to do under each of those conditions,
you could stick the basic code in a separate syntax file, and then run it
multiple times via INCLUDE FILE.  E.g., if the basic syntax is in file
BasicSyntax.sps:

USE ALL.
FILTER OFF.
INCLUDE FILE = "BasicSyntax.sps".

USE ALL.
FILTER BY atleast1.
INCLUDE FILE = "BasicSyntax.sps".

USE ALL.
FILTER BY atleast2.
INCLUDE FILE = "BasicSyntax.sps".

USE ALL.
FILTER BY atleast3.
INCLUDE FILE = "BasicSyntax.sps".


You cannot simply use SPLIT FILE (as you suggested previously), because your
filtering categories are not mutually exclusive.


Aenni wrote
> Hi Bruce
>
> Thanks so much for your support! I really appreciate it!
>
> I guess I have to model different variables to capture it. But I'm not
> quite sure.
> I would like to show
> for 0 (or any other number/ string): when I have no restriction about
> correct/ wrong questions --> include all cases
> for 1: when at least 1 question is correct --> include cases with 1,2,3
> correct questions
> for 2: when at least 2 questions are correct --> include cases with 2,3
> correct questions
> for 3: when all 3 questions are correct --> include only those cases in
> which all 3 questions are correctly answered
>
> Does this make sense?





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Split-file-according-to-3-string-questions-tp5734531p5734542.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



--
Jon K Peck
[hidden email]

===================== 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: Split file according to 3 string questions

Bruce Weaver
Administrator
Right.  Thanks Jon.  I was going by memory, and got it wrong!  

Jon Peck wrote
But please use INSERT rather than the obsolete INCLUDE.

On Tue, Jul 18, 2017 at 6:34 PM, Bruce Weaver <[hidden email]>
wrote:

> If there are several things you want to do under each of those conditions,
> you could stick the basic code in a separate syntax file, and then run it
> multiple times via INCLUDE FILE.  E.g., if the basic syntax is in file
> BasicSyntax.sps:
>
> USE ALL.
> FILTER OFF.
> INCLUDE FILE = "BasicSyntax.sps".
>
> USE ALL.
> FILTER BY atleast1.
> INCLUDE FILE = "BasicSyntax.sps".
>
> USE ALL.
> FILTER BY atleast2.
> INCLUDE FILE = "BasicSyntax.sps".
>
> USE ALL.
> FILTER BY atleast3.
> INCLUDE FILE = "BasicSyntax.sps".
>
>
> You cannot simply use SPLIT FILE (as you suggested previously), because
> your
> filtering categories are not mutually exclusive.
>
>
> Aenni wrote
> > Hi Bruce
> >
> > Thanks so much for your support! I really appreciate it!
> >
> > I guess I have to model different variables to capture it. But I'm not
> > quite sure.
> > I would like to show
> > for 0 (or any other number/ string): when I have no restriction about
> > correct/ wrong questions --> include all cases
> > for 1: when at least 1 question is correct --> include cases with 1,2,3
> > correct questions
> > for 2: when at least 2 questions are correct --> include cases with 2,3
> > correct questions
> > for 3: when all 3 questions are correct --> include only those cases in
> > which all 3 questions are correctly answered
> >
> > Does this make sense?
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.
> 1045642.n5.nabble.com/Split-file-according-to-3-string-
> questions-tp5734531p5734542.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
>



--
Jon K Peck
[hidden email]

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Split file according to 3 string questions

Aenni
Thanks so much!
I tried a couple of options now to play a bit with the syntax.
Many thanks for the great help!