Dynamic Value set defined for age not working for two or more people with same Age from Household Member Roster
Posted: June 13th, 2018, 12:47 pm
Dear CSPRO Community,
I am seeking for assistance from anyone out there. According to my survey designed, I want to duplicate three variables: HHIDNO, Name and Age which are HL1, HL2 and HL6, respectively from the Household Member Roster to other sections of my survey, say the Education Roster, with various Eligibility criteria. I used the eligibility criteria to define the occurrence control field for the Education Roster. For example the eligibility criteria for the education module based on Age, ie. HL6, included everyone from the Household member roster with age ranges from 7 to 64 years.
I succeeded in bringing HL1, HL2 and HL6 from household member roster to Education Roster using the following programs
PROC ED1
onfocus
// Create the value set for all the Elegibles 7-64 from Demographic_Roster
// for IDNO, Name and Age EDUCATION0N_ROSTER
numeric iRoster1;
numeric nextEntryValueSet = 1;
do iRoster1= 1 while iRoster1<= totocc(HOUSEHOLD_MEMBERS_ROSTER)
if seek(HL6 IN 7:64) then
seek(ED1 = HL1(iRoster1)) = 0
labels(nextEntryValueSet) = HL2(iRoster1);
codes(nextEntryValueSet) = (iRoster1);
nextEntryValueSet = nextEntryValueSet + 1;
//holderName = labels(nextEntryValueSet)
endif;
enddo;
codes(nextEntryValueSet) = notappl;
setvalueset(ED1, codes, labels);
ELEGIBLE = getlabel(ED1, ED1);
For name:
PROC ED2_1
ONFOCUS
$ = GETLABEL(ED1,ED1);
For Age:
Onfocus
numeric iRoster1;
numeric nextEntryValueSet = 1;
do iRoster1= 1 while iRoster1<= totocc(HOUSEHOLD_MEMBERS_ROSTER)
if seek(HL6 IN 7:64) then
seek(ED2_2 = HL6(iRoster1))= 0;
labels(nextEntryValueSet) = HL2(iRoster1);
codes(nextEntryValueSet) = HL6(iRoster1);
nextEntryValueSet = nextEntryValueSet + 1;
//ED2_2 = codes(nextEntryValueSet);
endif;
endif;
enddo;
codes(nextEntryValueSet) = notappl;
setvalueset(ED2_2, codes, labels);
These programs worked when we don’t have any two persons from Household member roster who incidentally happened to have the same age. But should you have any two members with the same age the results for the programs in ED2_2, Age failed to yield any meaningful results, although the ID No and Name still worked ok.
My problem, 1. Am seeking assistance to resolve the problem, If you have some Household members in Household members Roster with the same age.
Problem2. Can you bring the IDNum, Name and Age of eligible Household members from Household Member Roster to Education Roster using different coding and approach from the above? If so, how?
Attached is my survey for your attention and comprehension.
I am seeking for assistance from anyone out there. According to my survey designed, I want to duplicate three variables: HHIDNO, Name and Age which are HL1, HL2 and HL6, respectively from the Household Member Roster to other sections of my survey, say the Education Roster, with various Eligibility criteria. I used the eligibility criteria to define the occurrence control field for the Education Roster. For example the eligibility criteria for the education module based on Age, ie. HL6, included everyone from the Household member roster with age ranges from 7 to 64 years.
I succeeded in bringing HL1, HL2 and HL6 from household member roster to Education Roster using the following programs
PROC ED1
onfocus
// Create the value set for all the Elegibles 7-64 from Demographic_Roster
// for IDNO, Name and Age EDUCATION0N_ROSTER
numeric iRoster1;
numeric nextEntryValueSet = 1;
do iRoster1= 1 while iRoster1<= totocc(HOUSEHOLD_MEMBERS_ROSTER)
if seek(HL6 IN 7:64) then
seek(ED1 = HL1(iRoster1)) = 0
labels(nextEntryValueSet) = HL2(iRoster1);
codes(nextEntryValueSet) = (iRoster1);
nextEntryValueSet = nextEntryValueSet + 1;
//holderName = labels(nextEntryValueSet)
endif;
enddo;
codes(nextEntryValueSet) = notappl;
setvalueset(ED1, codes, labels);
ELEGIBLE = getlabel(ED1, ED1);
For name:
PROC ED2_1
ONFOCUS
$ = GETLABEL(ED1,ED1);
For Age:
Onfocus
numeric iRoster1;
numeric nextEntryValueSet = 1;
do iRoster1= 1 while iRoster1<= totocc(HOUSEHOLD_MEMBERS_ROSTER)
if seek(HL6 IN 7:64) then
seek(ED2_2 = HL6(iRoster1))= 0;
labels(nextEntryValueSet) = HL2(iRoster1);
codes(nextEntryValueSet) = HL6(iRoster1);
nextEntryValueSet = nextEntryValueSet + 1;
//ED2_2 = codes(nextEntryValueSet);
endif;
endif;
enddo;
codes(nextEntryValueSet) = notappl;
setvalueset(ED2_2, codes, labels);
These programs worked when we don’t have any two persons from Household member roster who incidentally happened to have the same age. But should you have any two members with the same age the results for the programs in ED2_2, Age failed to yield any meaningful results, although the ID No and Name still worked ok.
My problem, 1. Am seeking assistance to resolve the problem, If you have some Household members in Household members Roster with the same age.
Problem2. Can you bring the IDNum, Name and Age of eligible Household members from Household Member Roster to Education Roster using different coding and approach from the above? If so, how?
Attached is my survey for your attention and comprehension.