Dear All
Dear All
I kindly request to help me write a logic statement that will solve the problem I am facing. Below is one of the questions in my questionnaire. It is a multiple response question.
Q1. Could you please tell me what you think causes anemia or lack of blood in children? (Instructions: DO NOT READ OPTIONS, MULTIPLE RESPONSES APPLY)
L3-A I don't know any causes
L3-B Malaria
L3-C Fever
L3-D Worm infestation
L3-E Infection/being sick (not specified)
L3-F Poor quality diet (lack of iron in diet)
L3-G Malnutrition (e.g., stunted, "being malnourished," kwashiorker, & marasmus)
L3-H Lack of sufficient food
L3-I Supernatural causes (e.g., demonic possession)
L3-J Excessive bleeding
L3-K Sickle cell disease
L3-L Other genetic diseases
L3-M Other causes (specify)
Q2: Specify others (If L3-M has been selected)
I am using CAPI. In the data dictionary I created one question for Q1 which is alphanumeric and a length of 13 based on the options. The value set comprises of the above options code from A to M. On the form I used check box as the capture type. My problem is:
• How to write a logic statement that prevents selection of other options if L3-A has been selected
• How to skip Q2 if L3-M has not been selected
My other question is how to display in the CAPI question label an answer that has been provided in a given variable e.g.
Q3: Which of these following items does (NAME OF CHILD) usually use to eat semi-solid or solid foods such as millet or sweet potato? Hence how do I display the name of the child in the CAPI Question that is already indicated in a field that captures the child’s name?
Question about capi multiple responses
-
- Posts: 31
- Joined: June 22nd, 2012, 7:14 am
- Location: Yangon
Re: Question about capi multiple responses
Dear cjkakande,
How to write a logic statement that prevents selection of other options if L3-A has been selected
You can write with POS function & POSCHAR function.
if ( POS("A",Q1)>0 & POSCHAR("BCDEFGHIJKLM",Q1)>0 )then
errmsg("Don’t allow to choose Option-A and other options at the same time");
reenter;
endif;
• How to skip Q2 if L3-M has not been selected
you can write like this
if (POS("M",Q1)<1 then
set attributes (Q2)protect;
skip to Q3;
else
set attributes (Q2)native;
endif;
Q3: Which of these following items does (NAME OF CHILD) usually use to eat semi-solid or solid foods such as millet or sweet potato? Hence how do I display the name of the child in the CAPI Question that is already indicated in a field that captures the child’s name?
you already captured the child’s name.
let say child’s name item is CHILD_NAME
in capi question you need to write item name within %%
like this
Q3: Which of these following items does %CHILD_NAME% usually use to eat semi-solid or solid foods such as millet or sweet potato?
Best,
Nay Lin Soe
MYANMAR
How to write a logic statement that prevents selection of other options if L3-A has been selected
You can write with POS function & POSCHAR function.
if ( POS("A",Q1)>0 & POSCHAR("BCDEFGHIJKLM",Q1)>0 )then
errmsg("Don’t allow to choose Option-A and other options at the same time");
reenter;
endif;
• How to skip Q2 if L3-M has not been selected
you can write like this
if (POS("M",Q1)<1 then
set attributes (Q2)protect;
skip to Q3;
else
set attributes (Q2)native;
endif;
Q3: Which of these following items does (NAME OF CHILD) usually use to eat semi-solid or solid foods such as millet or sweet potato? Hence how do I display the name of the child in the CAPI Question that is already indicated in a field that captures the child’s name?
you already captured the child’s name.
let say child’s name item is CHILD_NAME
in capi question you need to write item name within %%
like this
Q3: Which of these following items does %CHILD_NAME% usually use to eat semi-solid or solid foods such as millet or sweet potato?
Best,
Nay Lin Soe
MYANMAR
Myanmar