This article is part of The Definitive Guide to Uploading and Preparing Data.
Sometimes you need to create a net on multiple response variables.
A net in this scenario, is defined as "at least one mention of". In Crunch, you can do this by creating a new subvariable which is added to the overall multiple response variable.
When making nets like this, you need to be mindful where there are different levels of missing data amongst the contributing variables. Do you want the net to consider only the common sample (ie: with no missingness, or "complete cases") or do you want to consider the entire sample or only the sample that has at least one value that is non-missing? You should check your subvariable to ensure it has the desired level of missingness before combining it into an array.
In the web app
- It's possible to achieve this in the web app using a careful combination of features a) save a new variable that will be the net, and then b) include it into an array
- You can create a new variable using the Filter Builder.
- You can edit an existing multiple response variable using Edit Variable under the Variable Properties of the multiple response variable.
- Note: in doing this, at present, you cannot build the build by referring to same array that you want to add it to. You should go back to referring to source variables when building a new derivation.
Using R
Crunch Automation
- You can create a net on a multiple response variable using a combination of Crunch Automation commands. Typically:
- CREATE CATEGORICAL CASE to define the net variable
- ALTER ARRAY to insert the net variable into the multiple response variable, as a subvariable
Example:
Using the Core Trends Study example:
# Define a multiple response variable:
CREATE MULTIPLE DICHOTOMY
bbsmart3a, bbsmart3b, bbsmart3c, bbsmart3d, bbsmart3e, bbsmart3f
LABELS
"The monthly cost of a home broadband subscription is too expensive",
"The cost of a computer is too expensive",
"Your smartphone lets you do everything online that you need to do",
"You have other options for internet access outside of your home",
"Broadband service is not available where you live, or is not available at an acceptable speed",
"Some other reason I haven't already mentioned (SPECIFY)"
SELECTED "Yes"
AS bbsamrt3_mr
TITLE "Reasons for not having broadband"
DESCRIPTION "Please tell me whether any of the following are reasons why you do not have high-speed internet at home";
# Create the net variable (separate to the array above).
# This example refers to the original originals and creates a net of "Cost considerations".
# The line around missing data is optional and only pertains to this example because the original subvariables have
# missing data. Careful use of sequential logic is required for CREATE CATEGORICAL CASE to define the desired net
# variable (with correct level of "missingness"):
CREATE CATEGORICAL
CASE
WHEN bbsmart3a = "Yes" OR bbsmart3b = "Yes"
THEN "Selected" CODE 1
WHEN bbsmart3a = NULL OR bbsmart3b = NULL
THEN "No Data" CODE 2 MISSING
ELSE "Other" CODE 0
END
AS bbsmart3_net
TITLE "Net: Cost";
ALTER ARRAY bbsamrt3_mr ADD bbsmart3_net POSITION FIRST;