Transforming multi-response questions into several single response questions

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

Transforming multi-response questions into several single response questions

Slyrs
Hello!
I would really appreciate help on the following task.

Data
I have two multiple response sets of 10 variables each - which belong together.
- The first set contains up to 10 smartphone apps the respondent was able to indicate whether he/she is using (value labels range from 1 to 23, one label for each app category)
- The second set of up to ten variables next to the above carries the intensity of usage for each app which has been stated (labels range from 1 to 6).

    DATA LIST LIST /app1 app2 app3 app4 app5 appuse1 appuse2 appuse3 appuse4 appuse5.
    BEGIN DATA.
    11 15 3 11 18 3 2 2 3 3
    11 11 8 15 17 4 3 2 1 4
    13 13 16 13 15 5 5 4 3 1
    14 18 20 18 10 3 3 4 4 4
    END DATA.
    LIST.

Task
I would like to have 23 variables which carry the usage of the respondent for each app.

I know that there is code for transforming a multi-response question into several single response questions (see below). But this code leads only to the information whether the app has been stated or not.

I hope I made myself clear and would be happy for any help.
Slyrs

Code for transforming multi-response question into several single response questions:
NUMERIC golf swimming running tennis cycling wt_train lacross baseball soccer football waterpolo rowing canoeing rugby gymnastics (f4).
    VECTOR mr = sport1 to sport5 / md = golf to gymnastics.
    LOOP #i = 1 to 5.
    IF not(missing(mr(#i))) md(mr(#i)) = 1.
    END LOOP.
    RECODE golf to gymnastics (sysmis = 0).
    EXECUTE.
Reply | Threaded
Open this post in threaded view
|

Re: Transforming multi-response questions into several single response questions

David Marso
Administrator
Maybe something like:
VECTOR result(23).
VECTOR app=app1 TO app5 / use=appuse1 TO appuse5.
LOOP #=1 TO 5.
COMPUTE result(app(#))=use(#).
END LOOP.
---
Slyrs wrote
Hello!
I would really appreciate help on the following task.

Data
I have two multiple response sets of 10 variables each - which belong together.
- The first set contains up to 10 smartphone apps the respondent was able to indicate whether he/she is using (value labels range from 1 to 23, one label for each app category)
- The second set of up to ten variables next to the above carries the intensity of usage for each app which has been stated (labels range from 1 to 6).

    DATA LIST LIST /app1 app2 app3 app4 app5 appuse1 appuse2 appuse3 appuse4 appuse5.
    BEGIN DATA.
    11 15 3 11 18 3 2 2 3 3
    11 11 8 15 17 4 3 2 1 4
    13 13 16 13 15 5 5 4 3 1
    14 18 20 18 10 3 3 4 4 4
    END DATA.
    LIST.

Task
I would like to have 23 variables which carry the usage of the respondent for each app.

I know that there is code for transforming a multi-response question into several single response questions (see below). But this code leads only to the information whether the app has been stated or not.

I hope I made myself clear and would be happy for any help.
Slyrs

Code for transforming multi-response question into several single response questions:
NUMERIC golf swimming running tennis cycling wt_train lacross baseball soccer football waterpolo rowing canoeing rugby gymnastics (f4).
    VECTOR mr = sport1 to sport5 / md = golf to gymnastics.
    LOOP #i = 1 to 5.
    IF not(missing(mr(#i))) md(mr(#i)) = 1.
    END LOOP.
    RECODE golf to gymnastics (sysmis = 0).
    EXECUTE.
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: Transforming multi-response questions into several single response questions

David Marso
Administrator
In reply to this post by Slyrs
Presumably your posted sample data are not intended as actual exemplars as you have duplicate values in your app variables.  Please next time post a data example that actually reflects the true situation you are attempting to resolve.  Also next time post an example of what the desired result should be.
--
Slyrs wrote
Hello!
I would really appreciate help on the following task.

Data
I have two multiple response sets of 10 variables each - which belong together.
- The first set contains up to 10 smartphone apps the respondent was able to indicate whether he/she is using (value labels range from 1 to 23, one label for each app category)
- The second set of up to ten variables next to the above carries the intensity of usage for each app which has been stated (labels range from 1 to 6).

    DATA LIST LIST /app1 app2 app3 app4 app5 appuse1 appuse2 appuse3 appuse4 appuse5.
    BEGIN DATA.
    11 15 3 11 18 3 2 2 3 3
    11 11 8 15 17 4 3 2 1 4
    13 13 16 13 15 5 5 4 3 1
    14 18 20 18 10 3 3 4 4 4
    END DATA.
    LIST.

Task
I would like to have 23 variables which carry the usage of the respondent for each app.

I know that there is code for transforming a multi-response question into several single response questions (see below). But this code leads only to the information whether the app has been stated or not.

I hope I made myself clear and would be happy for any help.
Slyrs

Code for transforming multi-response question into several single response questions:
NUMERIC golf swimming running tennis cycling wt_train lacross baseball soccer football waterpolo rowing canoeing rugby gymnastics (f4).
    VECTOR mr = sport1 to sport5 / md = golf to gymnastics.
    LOOP #i = 1 to 5.
    IF not(missing(mr(#i))) md(mr(#i)) = 1.
    END LOOP.
    RECODE golf to gymnastics (sysmis = 0).
    EXECUTE.
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: Transforming multi-response questions into several single response questions

Slyrs
In reply to this post by David Marso
Dear David
thank you very much for the reply and your help.

I will also take your advice concerning presenting the actual data. The reason for the duplicates is that the apps where manually coded into the 23 categories. Hence, if a participant stated "wheather app" and "temperature app" both got the value 11, for instance.

I also changed one line in your code due to the possibility of missing data:

IF not(missing(app(#))) result(app(#))=use(#).

Thanks again for your support.
Slyrs

Reply | Threaded
Open this post in threaded view
|

Re: Transforming multi-response questions into several single response questions

Kirill Orlov
In reply to this post by Slyrs
This sort of task in its several versions is solved by my old macro called  !SRSREF: UNWRAPPING SERIES OF ITEMS OUT OF PACKED ENTRY MODE WITH THE HELP OF A REFERENCE VARIABLES SET and is found in the collection "Series Responce tools" on my page http://www.spsstools.net/en/KO-spssmacros.

The macro is well-documented; unfortunately, I haven't translated it in English in full.

What you have is 1) Categorical Multiple response set (MRC) where 1 to 23 items are possible. 2) A few variables with scores or something pertaining to the items, and the entry is not in 23 variables but is packed, "without spaces", so to speak, in those few variables. You need to unwrap the few variables with scores into the complete set of 23 Series Response variables (aka matrix question variables).

So, what you have is not two MRCs but rather an MRC (multiple response set, categorical) and the corresponding SRS (single response series), but in packed entry mode. You want to unpack the SRS into its complete form.

DATA LIST LIST /app1 app2 app3 app4 app5 appuse1 appuse2 appuse3 appuse4 appuse5.
BEGIN DATA.
11 15 3 11 18 3 2 2 3 3
11 11 8 15 17 4 3 2 1 4
13 13 16 13 15 5 5 4 3 1
14 18 20 18 10 3 3 4 4 4
END DATA.
LIST.

!srsref series= appuse1 to appuse5 /*Variables “series” containing data to be copied;
                          /*should be consecutive and write via “to”
    /refer= app1 to app5 /*Variables “reference” (MRC set) containing codes of the items selected;
                          /*write either name-by-name or via “to”
    /rated= 1 to 23  /*List of codes (non-negative numbers either name-by-name or range min to max)
                        /*of all items that were being rated
    /except=     /*Optional: except these not rated codes (name-by-name of integers);
                        /*active only if RATED specified via “to”
    /pack= MREFER  /*Mode of pack in the “series”: monotonic to the list RATED (MRATED),
                       /*isomorphic (IREFER) or monotonic (MREFER) to the pack in REFER
    /cap=  'x'  /*Prefix into varnames of a new series (SRS) being created
    /rtimes= 3   /*For PACK=IREFER,MREFER: how many times at max the same code could be selected
                     /*by respondent (default=1)
    /noans= 99  /*Optional: value "no rating" into the created variables
                    /*(an item was selected but its rating in SERIES is missing value)
    /nosel=   /*Optional: value "item not selected" into the created variables,
                    /*it will become user-missing.


The most important subcommand here is PACK: by it you indicate the rule of correspondence between the MRC and the
packed series variables.

MRATED
– entry monotonic to the list of items. The scores are entered left to right monotonically in the same sequence as the items go in list RATED. For all respondents. Sequence of entry of codes in REFER mrc-set plays no role.
IREFER – entry isomorphic to the choice order of items. The score of an item is found in the SERIES variable of the same ordinal number as the REFER variable containing the code of that item. Different respondents might have different such correspondent order of codes and scores. Number of SERIES variables must be equal to number of REFER variables.
MREFER – entry monotonic to the choice order of items.
The scores are entered left to right monotonically in the same sequence as as the codes of the corresponding to them items go in REFER variables. Different respondents might have different such correspondent order of codes and scores.

When we inspect how your data is entered we may conclude that MREFER and IREFER fit in here. MREFER is more general.

What is peculiar in your example data is that a respondent is allowed to endorse an item more than once (probably it is the same app installed on different smartphones, I don't know). Let's assume that maximally one can endorse an item thrice (you have to know or have established it before using the macro). Set RTIMES=3. Three variables will be created for each of 23 items. If no duplicate codes had been allowed in the mrc set we would have set RTIMES=1 and get 23, not 23*3, variables.


24.11.2015 1:17, Slyrs пишет:
Hello!
I would really appreciate help on the following task.

Data
I have two multiple response sets of 10 variables each - which belong
together.
- The first set contains up to 10 smartphone apps the respondent was able to
indicate whether he/she is using (value labels range from 1 to 23, one label
for each app category)
- The second set of up to ten variables next to the above carries the
intensity of usage for each app which has been stated (labels range from 1
to 6).

    DATA LIST LIST /app1 app2 app3 app4 app5 appuse1 appuse2 appuse3 appuse4
appuse5.
    BEGIN DATA.
    11 15 3 11 18 3 2 2 3 3
    11 11 8 15 17 4 3 2 1 4
    13 13 16 13 15 5 5 4 3 1
    14 18 20 18 10 3 3 4 4 4
    END DATA.
    LIST.

Task
I would like to have 23 variables which carry the usage of the respondent
for each app.

I know that there is code for transforming a multi-response question into
several single response questions (see below). But this code leads only to
the information whether the app has been stated or not.

I hope I made myself clear and would be happy for any help.
Slyrs

Code for transforming multi-response question into several single response
questions:
NUMERIC golf swimming running tennis cycling wt_train lacross baseball
soccer football waterpolo rowing canoeing rugby gymnastics (f4).
    VECTOR mr = sport1 to sport5 / md = golf to gymnastics.
    LOOP #i = 1 to 5.
    IF not(missing(mr(#i))) md(mr(#i)) = 1.
    END LOOP.
    RECODE golf to gymnastics (sysmis = 0).
    EXECUTE. 



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Transforming-multi-response-questions-into-several-single-response-questions-tp5731019.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: Transforming multi-response questions into several single response questions

Slyrs
Dear Kirill!

Thank you very much for your extensive answer. I will check this with my original dataset and let you know how I proceeded. This might take some time ...

Best regards
Slyrs
Reply | Threaded
Open this post in threaded view
|

Re: Transforming multi-response questions into several single response questions

Jon K Peck
In reply to this post by Kirill Orlov

Note also the STATS MCSET CONVERT extension command. From its help ...

Convert a multiple category set into a multiple dichotomy set.

STATS MCSETS CONVERT MCSET=mcset VARPREFIX=string SETNAME=setname.
/HELP

All fields are required.

Example:
STATS MCSET CONVERT MCSET = $mcset1 VARPREFIX=set1 SETNAME=$fromset1.

This procedure converts a multiple category set into a multiple dichotomy set.
It generates a dichotomous variable for each value found in the variables
that define the MC set and assigns the value labels, if any, taken from the
first variable in the set as the variable labels of the new variables.

You might want to do this in order to use the
STATS CATEGORY ORDER extension command for working with CTABLES.

Existing variables are overwritten, but if there is a type conflict,
an error will be generated.


MCSET is a multiple category set to convert to a multiple dichotomy set.


VARPREFIX specifies text that will be prepended to the names of the generated
names that form the output. The generated names have the form
prefix_nn
where nn is a number and may overwrite an existing variable.

SETNAME is the name for the output multiple dichotomy set.

/HELP displays this text and does nothing else.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621


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