Page 1 of 2

Roster operation

Posted: November 21st, 2021, 10:11 pm
by Mahedi1991
What will be the logic if present roster is asked only if age greater than 5 in previous roster?

Re: Roster operation

Posted: November 22nd, 2021, 1:02 pm
by aaronw
In the first field of the second roster add a field that skips to the next occurrence if the person is 5 or less.
preproc

if
AGE <= 5 then
    skip to next
;
endif;
Here's the helps for skips which will include information on skip to next: https://www.csprousers.org/help/CSPro/s ... ement.html

Re: Roster operation

Posted: December 20th, 2021, 12:53 pm
by Mahedi1991
Thanks for your reply, but this logic does not work as shows subscript error.

Re: Roster operation

Posted: December 20th, 2021, 1:05 pm
by sherrell
I think the original question:

>What will be the logic if present roster is asked only if age greater than 5 in previous roster?

meant to say ROW, not roster. However, even if a repeating record has been split into two rosters, with AGE being placed in the first roster, and it is evaluated in the second roster, the logic will work.

If you wish to use this logic and are encountering problems, please zip up your application and post it here so we can take a look.

Thanks,
Sherrell

Re: Roster operation

Posted: December 20th, 2021, 9:50 pm
by Mahedi1991
Thanks , Please take a look in section 01 and section 02. I need to set a logic that will work as "Section 02 is asked only if age is over 5 in section 01.

Re: Roster operation

Posted: December 21st, 2021, 12:11 pm
by sherrell
Hi Mahedi,

See attached for a few revisions. A few observations too:

[1] See the postproc of IDCODE_R2 for how to handle the age skip.

[2] IDCODE_R1/R2: you don't need to define each value, just use a range (see the dcf)

[3] AGE: no range has been defined. This means someone could enter negative values or very large values. I don't think you'll have too many people age 200 and above :)

[4] AGE_MONTH: should this be asked of everyone, or only those under a (lower) age? For as people get older they often barely know their own age, let alone how many months they are past their birthday. Also, you have an error message triggering if this value is > 11, yet the dictionary is allowing 3 digits.

[5] IDCODE_R2 & SEC_NAME: I moved the assignment of these variables to the preproc of the roster. Putting this logic within a roster variable means the logic will be repeated for every person. It won't slow down this small application, but when you start developing larger apps, you'll want to eliminate this type of code duplication.

[6] Within CSPro's "Tools" menu there is a "pack application" option. This is the best way to send files, as you don't have to think about what's been included within your application (especially if you have files from other folders being used), as it knows what to pull in.

Sherrell

Re: Roster operation

Posted: December 21st, 2021, 1:00 pm
by Mahedi1991
Hi Sherrell,
Thanks for your support. It works as i need to and also thanks for your important feedback.
Mahedi

Re: Roster operation

Posted: December 21st, 2021, 1:13 pm
by sherrell
You bet. Have a good rest of the year. Sherrell

Re: Roster operation

Posted: December 22nd, 2021, 7:13 am
by Mahedi1991
Hi sherrell,
There is a problem in endgruop command. Roster doesn't end after idcode_R2>tot_pers.
Mahedi

Re: Roster operation

Posted: December 22nd, 2021, 10:24 am
by sherrell
Hi Mahedi,

Ooops! Sorry, I was playing around with things. I'm not a fan of having empty records, so I made a last minute change to eliminate it from the 2nd roster, which then caused the endgroup to not work properly. See attached for a fix, where I keep the empty record in the 2nd roster (which at least allows it to stay in sync w/the first roster). A more controlled way to handle the # of HH members is to have a field before you drop into the HH roster that asks how many people live in the HH. If the enumerator finds out there are more/fewer during the interview, they can always go back to that field and change the value. I'm assuming you are not allowing vacant HHs? For if so, then you would definitely want a field asking about # of persons.

Sherrell