Logic to lookout in a number of previous response variable if No answer is choosen

Discussions about CSEntry
Post Reply
sham
Posts: 69
Joined: February 3rd, 2022, 7:30 pm

Logic to lookout in a number of previous response variable if No answer is choosen

Post by sham »

Hi family,
I have couple of questions(Q1,Q2,Q3...Q30) seeking to know if a particular activity has occurred with an option such as Yes=1 No=2 or DK= 3.
So Q31 asked "Are you sure there is no any activity at all"? if Yes then CAPI should proceed and if NO then logic should take the enumerator back to Q1) asked as a validation if it identifies that all response in Q1 to Q30 recorded either No(2) or DK(3).

In summary:
Q1: Q30 asked is this activity occurred? Yes(1) No(2) DK(8)

Q31: Are you sure from Q1 to Q30 none of the various activities happened?

My challenge now is how do I create a logic in this situation?
where Q31 Is only asked if all responses from Q1 to Q30 is Either No(2) or DK(2)


So at Q31


This was my logic and did not workout
PROC Q31
preproc
Ask if (Q1 : Q30) = 2 or (Q539 : Q560)= 8;
postproc
if $= 2 then
reenter Q1;
endif;
I did not succeed with the above logic

I will appreciate any support from the family here please?

Thank you
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Logic to lookout in a number of previous response variable if No answer is choosen

Post by sherrell »

Hi Sham,

>Ask if (Q1 : Q30) = 2 or (Q539 : Q560)= 8;

I'll have to let one of the guys answer on why the above compiled, for I'm not sure how CSPro would interpret "Q1 : Q30" and "Q539:Q560".

As to your task, I would make a single alpha variable in your dictionary 30 chars long, and make the 1-30 questions subitems within it. After you've entered all the data, just use the POS function to see if '1' appeared within the main string, and take the desired action. Be sure to define valuesets for the subitems.

Sherrell
aaronw
Posts: 565
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: Logic to lookout in a number of previous response variable if No answer is choosen

Post by aaronw »

You could use a roster and min to query whether an activity has been performed. Occurrence labels are used to make the CAPI text dynamic. This application will show the last question if the activity was ever performed, otherwise the question is skipped.
survey.zip
(2.9 KiB) Downloaded 125 times
sham
Posts: 69
Joined: February 3rd, 2022, 7:30 pm

Re: Logic to lookout in a number of previous response variable if No answer is choosen

Post by sham »

Hi Sherrell,
Thank you soo much.
It is very helpful.

sham
Post Reply