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.
Dynamic Value set defined for age not working for two or more people with same Age from Household Member Roster
Dynamic Value set defined for age not working for two or more people with same Age from Household Member Roster
- Attachments
-
- GMLFS2018 (1).zip
- (754.1 KiB) Downloaded 363 times
Last edited by lmoriba on June 18th, 2018, 6:03 pm, edited 1 time in total.
-
- Posts: 1805
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Dynamic Valuable set defined for age not working for two or more people with same Age from Household Member Roster
I have a question about what you are trying to accomplish in this section. Once they select the person in ED1, why are you asking the interviewer to select the age rather than just prefilling it?
If you executed this in the postproc of ED1, it would prefill the age:
If you executed this in the postproc of ED1, it would prefill the age:
ED2_2 = HL6(ED1);
-
- Posts: 574
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Dynamic Valuable set defined for age not working for two or more people with same Age from Household Member Roster
Dear
You should use prefill option as Gregory mentioned but as per your requirement please see following codes:
Please try this in ED1
and in ED2_2
Best.
a.
You should use prefill option as Gregory mentioned but as per your requirement please see following codes:
Please try this in ED1
Code: Select all
numeric iRoster1;
numeric nextEntryValueSet = 1;
numeric seekdata;
do iRoster1= curocc() while iRoster1<= totocc(HOUSEHOLD_MEMBERS_ROSTER)
seekdata=seek( HL6 >=7 and HL6<=46, @iRoster1 );
if seekdata>0 then
labels(nextEntryValueSet) = HL2(seekdata);
codes(nextEntryValueSet)= HL1(seekdata);
nextEntryValueSet = nextEntryValueSet + 1;
//holderName = labels(nextEntryValueSet)
endif;
enddo;
codes(nextEntryValueSet) = notappl;
setvalueset(ED1, codes, labels);
//
//onfocus
ELEGIBLE = getlabel(ED1, ED1);
Code: Select all
Preproc
numeric iRoster1;
numeric nextEntryValueSet = 1;
numeric seekdata;
do iRoster1= curocc() while iRoster1 <=totocc(HOUSEHOLD_MEMBERS_ROSTER)
seekdata=seek( HL6 >=7 and HL6<=46, @iRoster1 );
if seekdata>0 then
labels(nextEntryValueSet) = HL2(seekdata);
codes(nextEntryValueSet) = HL6(seekdata);
nextEntryValueSet = nextEntryValueSet + 1;
endif;
enddo;
codes(nextEntryValueSet) = notappl;
setvalueset(ED2_2, codes, labels);
a.
Re: Dynamic Valuable set defined for age not working for two or more people with same Age from Household Member Roster
Dear Gregory and Arshad,
Many thanks for your suggested solutions to my dilemma. In fact both suggestions represented adequate solutions to my problems. They were the solutions I was looking for.
So, I thank you all, once again, for coming to my aid, ASAP.
Regards,
LmJ
Many thanks for your suggested solutions to my dilemma. In fact both suggestions represented adequate solutions to my problems. They were the solutions I was looking for.
So, I thank you all, once again, for coming to my aid, ASAP.
Regards,
LmJ
-
- Posts: 574
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Dynamic Valuable set defined for age not working for two or more people with same Age from Household Member Roster
Dear
Please see first three questions in Education and Training section. I have made some changes in the syntax to get pre-filled data from "Name Forms and Household Members Forms.
If it is fine then you can apply in the rest of sections.
Best.
a.
Please see first three questions in Education and Training section. I have made some changes in the syntax to get pre-filled data from "Name Forms and Household Members Forms.
If it is fine then you can apply in the rest of sections.
Best.
a.
- Attachments
-
- GMLFS2018.rar
- (640.76 KiB) Downloaded 354 times
Re: Dynamic Value set defined for age not working for two or more people with same Age from Household Member Roster
Many thanks Arshad, I found the coding useful and I decided to use them. So, thank you., once again.