Hi family,
I have a challenge here.
I created a setvalueset from the a roster using preproc. Is there a way to allow the system to select the 1st option that appear in the setvalueset RESULTS regardless about the value serial numbering?
for example
Below is the logic I used to pull out the list of eligible person's in the household age 15-49years at random
PROC ID_FROM_THE_ROSTER
preproc
do numeric i = 1 while i <= totocc(ROSTER000)
if AGE(i) in 15:149 then
RosterRespondent.add(NAME(i),i);
endif;
enddo;
seed(systime());
RosterRespondent.randomize();
setvalueset($,RosterRespondent);
the results I got is;
option1 3. Child1
option2 5. Child
option1 7. Child5
Can any one assist me with a logic to make the program automatically select the the 1st position(child3) from the setvalueset results above?
Thank you
Automatically make the system to preselect the 1st options that appear in setvalueset
Forum rules
New release: CSPro 8.0
New release: CSPro 8.0
-
- Posts: 1777
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Automatically make the system to preselect the 1st options that appear in setvalueset
You can access the codes and labels as lists:
https://www.csprousers.org/help/CSPro/valueset.html
So this would give you the first code (if one has been defined):
https://www.csprousers.org/help/CSPro/valueset.html
So this would give you the first code (if one has been defined):
RosterRespondent.codes(1)
Re: Automatically make the system to preselect the 1st options that appear in setvalueset
Sham, I hope you've noticed the typo in your logic. You wrote the following comment:
>Below is the logic I used to pull out the list of eligible person's in the household age 15-49years at random
Yet your logic is checking to 149 years:
>if AGE(i) in 15:149 then
Sherrell
>Below is the logic I used to pull out the list of eligible person's in the household age 15-49years at random
Yet your logic is checking to 149 years:
>if AGE(i) in 15:149 then
Sherrell
Re: Automatically make the system to preselect the 1st options that appear in setvalueset
Hi,
@Sherrell you got it right it is indeed a typo from me. I actually mean 15-49.
@ Gregory Martin thank you very much for the guide.
It is working soo well.
I Am grateful.
@Sherrell you got it right it is indeed a typo from me. I actually mean 15-49.
@ Gregory Martin thank you very much for the guide.
It is working soo well.
I Am grateful.