Dear all,
Usually when i use check box for multiple choice questions, i convert several items in subitem because i want to analyze both item and subitem. But unfortunately when i export data, the subitem are not sorted in a good logic. By exemple, asumming i have four possibilities of choice: 1,2,3,4 and i have 4 subitems: I,J,K,L, so I must be 1, J must be 2, K must be 3, L must be 4 converted in a item with check box IJKL (1234). If IJKL=1234, automatically in the subitems, I=1, J=2, K=3, L=4 all are ok. But i the event of IJKL=124 problem occurs because I=1,J=2 and K=4...
However, the logical responses must be: I=1,J=2, K="" and L=4.
Please, does someone can help me to correct with logical?
Thanks in advance.
Check box and subitem
Check box and subitem
- Attachments
-
- Multiple_choice_subitem.zip
- (2.42 KiB) Downloaded 338 times
G.VOLNY, a CSProuser from Haiti, since 2004
-
- Posts: 1812
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Check box and subitem
There is no way to automatically separate your check box responses into the desired subitems, but you can do this with some awkward logic. This works, based on your application:
PROC GLOBAL
array alpha (5) responses(4) = "ENSP/", "CLSP/", "MESP/", "AUTRE";
PROC DE_QUELLE_MANIERE_SE_FAIT_IL
numeric ctr;
do ctr = 4 while ctr >= 1 by -1
if pos(responses(ctr),DE_QUELLE_MANIERE_SE_FAIT_IL) then
// the response was found; insert it in the correct part of the string
DE_QUELLE_MANIERE_SE_FAIT_IL[(ctr * 5 - 4):5] = responses(ctr);
else
// the response was not found; insert blanks to clear this response
DE_QUELLE_MANIERE_SE_FAIT_IL[(ctr * 5 - 4):5] = "";
endif;
enddo;
array alpha (5) responses(4) = "ENSP/", "CLSP/", "MESP/", "AUTRE";
PROC DE_QUELLE_MANIERE_SE_FAIT_IL
numeric ctr;
do ctr = 4 while ctr >= 1 by -1
if pos(responses(ctr),DE_QUELLE_MANIERE_SE_FAIT_IL) then
// the response was found; insert it in the correct part of the string
DE_QUELLE_MANIERE_SE_FAIT_IL[(ctr * 5 - 4):5] = responses(ctr);
else
// the response was not found; insert blanks to clear this response
DE_QUELLE_MANIERE_SE_FAIT_IL[(ctr * 5 - 4):5] = "";
endif;
enddo;
Re: Check box and subitem
Dear Gregory,
The code you posted work fine and i understand very well his logic either for this sample or for IJKL/1234 or for others.
Concerning IJKL/1234 i use excel to find the better combination of numbers using the formula (A1*B1)-C1 who is able to give the 1,3,5,7 numbers.
In your logic this combination give 1,6,11,16.
Thank you for your precious help!
The code you posted work fine and i understand very well his logic either for this sample or for IJKL/1234 or for others.
Concerning IJKL/1234 i use excel to find the better combination of numbers using the formula (A1*B1)-C1 who is able to give the 1,3,5,7 numbers.
In your logic this combination give 1,6,11,16.
Thank you for your precious help!
G.VOLNY, a CSProuser from Haiti, since 2004