Hi Family,
This time round, I have a variable(Q1) with multiple selection and want to create another variable(Q2) but which should contain only the once that were selected in Q1. what do I do?
Q1(Select multiple)
A. YAM
B. Cassava...............selected
C. Maize,.................selected
D.. Millet
E. NONE
So I want in Q2 to have a preloaded options for those that were selected in Q1
I tried all the magic and went through documentation but still not getting it.
Q2(Multiple select)
A. Cassava
B. Maize
This is the logic that I used but did not succeed
Q2
preproc
valueset string vs1 = Q1_VS1;
do numeric i=1 while i<=length(Q1)
vs1.add(Q1[i:1]);
enddo;
setvalueset(Q2, vs1);
ERROR(6): Invalid function call (comma expected)
I will appreciate your support family.
Creating a multiple response based on the previous Multiple selected
-
- Posts: 1801
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Creating a multiple response based on the previous Multiple selected
In this line:
You're only passing the code. Try this:
vs1.add(Q1[i:1]);
The ValueSet.add function requires at least two arguments, the label and the code: https://www.csprousers.org/help/CSPro/v ... ction.htmlYou're only passing the code. Try this:
vs1.add(getlabel(Q1, Q1[i:1]), Q1[i:1]);
Re: Creating a multiple response based on the previous Multiple selected
Hi Martin,
Thank you soo much for your swift guide.
Below is my updated logic reference to your guide.
Q2
preproc
valueset string vs1 = Q1_VS1;
do numeric i=1 while i<=length(Q1)
s1.add(getlabel(Q1, Q1[i:1]), Q1[i:1]);
enddo;
setvalueset(Q2, vs1);
But the logic is silent. I read the attach link but still do not get it.
Kindly find the attach setup for more clarity.
I really appreciate your support.
Thank you soo much for your swift guide.
Below is my updated logic reference to your guide.
Q2
preproc
valueset string vs1 = Q1_VS1;
do numeric i=1 while i<=length(Q1)
s1.add(getlabel(Q1, Q1[i:1]), Q1[i:1]);
enddo;
setvalueset(Q2, vs1);
But the logic is silent. I read the attach link but still do not get it.
Kindly find the attach setup for more clarity.
I really appreciate your support.
- Attachments
-
- mresponse.zip
- (58.05 KiB) Downloaded 88 times
Re: Creating a multiple response based on the previous Multiple selected
See attached Sham. I've adjusted the logic & added notes about what needed changing. Sherrell
- Attachments
-
- Mresponse (smg).zip
- (3.07 KiB) Downloaded 123 times
Re: Creating a multiple response based on the previous Multiple selected
Waooo!!!,
It works so well.
Thank you sherrell .
I am most gratiful.
It works so well.
Thank you sherrell .
I am most gratiful.