How to link levels under menu program

Discussions about CSEntry
Post Reply
Nikola
Posts: 27
Joined: December 24th, 2021, 4:30 am

How to link levels under menu program

Post by Nikola »

Dear CSPro users,

I have some questions about the menu program.

First, the flow is like below:
Menu → Household survey(launch household dictionary) → Menu → Individual survey(launch individual dictionary) → Menu → Individual survey(launch individual dictionary).

Please see the CSPro example files attached.

Question 1: How to make "ask if" logic is working between two different dictionaries (Household survey - Individual survey)?
1) PROC ASK_IF_CHILDREN (from Household survey)
<Instruction> Ask only if one of the respondents' age(PROC AGE from Individual survey) is under 18 question.

2) PROC ASK_IF_OTHER_ADULT (from Household survey)
<Instruction> Ask only if there are more than two adults in the household member. (PROC AGE from Individual survey)

Question 2: How to fill in the individual survey's id items automatically based on the Household survey's id items?
How to link the two dictionaries by id items?

It would be appreciated if you add codes in the example file attached.

Thank you in advance.
Attachments
Menu_Example.zip
(134 KiB) Downloaded 106 times
sherrell
Posts: 400
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: How to link levels under menu program

Post by sherrell »

Hi Nikola,

Question 1:
It looks like this post is a continuation of your earlier post here: viewtopic.php?f=1&t=4885&p=15402#p15402

When you do a loadcase call, you want to use the IDs of the same household; therefore, you should do the loadcase passing in those values. Then, you just need to count the number of persons in the HH roster who are under 18. I'm not quite clear if you want to ask your question if there's only ONE person under 18, or if there's AT LEAST one person under 18. The logic does the former, the comment does the latter.

Code: Select all

PROC ASK_IF_CHILDREN
preproc
    loadcase(HOUSEHOLD_DICT, IN_PROVINCE, IN_DISTRICT_MUNICIPALITY, 
			     IN_LOCAL_MUNICIPALITY, IN_HOUSEHOLD_NUMBER, IN_HOUSEHOLD_IDENTIFICATION);
    numeric i = count (HOUSEHOLD_REC where AGE in 0:17);
    ask if i = 1;	// or ask if i <> 0?
You'll do the exact same thing except changing the age to >= 18 for the second check.

Question 2:

You would have to ask for the IDs in the menu application, so you can pass those values down through your PFF file.

Sherrell
Nikola
Posts: 27
Joined: December 24th, 2021, 4:30 am

Re: How to link levels under menu program

Post by Nikola »

Thank you so much!
Post Reply