Making setvalueset (using a prev HH list) a check box option

Discussions about CSEntry
Post Reply
jbthompson21
Posts: 18
Joined: April 2nd, 2015, 4:05 pm

Making setvalueset (using a prev HH list) a check box option

Post by jbthompson21 »

Hi, Just had a quick question, don't know if it can be done or not but thought I'd give it a shot. Using the code below I am taking a previously listed household roster and turning it into a value set for a future question. I've tried but I can't figure it out, is there any way that I can make this value set multiple choice, using check boxes? Have tried different response box lengths, ect. and haven't been able to find a way. Would be nice in some instances to select more than one family member depending on the question, using this example. Thanks!

preproc
X3_TP = totalPopulation;
{person_num = curocc(); { the current person number }
$ = person_num;}

numeric i;
do i = 0 until i = totalPopulation

namesVSCodes(i) = i + 1;
currentHHName = strip(A1(i+1));
namesVSNames(i) = maketext(currentHHName);
enddo;

namesVSCodes(i) = 66;
namesVSNames(i) = "END Household Members";
namesVSCodes(i+1) = notappl;

setvalueset(NAME_TEST, namesVSCodes, namesVSNames);
josh
Posts: 2403
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Making setvalueset (using a prev HH list) a check box op

Post by josh »

Yes, this is possible. You need to make sure the variable is of type alpha and on the form you set need to set the capture type to checkbox in the field properties. This will give you a checkbox.

To create the value set your logic would be similar to what you have below except that you would have to use an array of strings for the codes (namesVSCodes) instead of a numeric array.

I'm attaching an example that does this. It creates a dynamic value set for a multiple response question "which members of the household ate a meal at home?". This particular example is in French but it shouldn't be hard to follow. Look in the proc for REPAS000.
You do not have the required permissions to view the files attached to this post.
Post Reply