Skip Columns in Roster

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Nad
Posts: 3
Joined: February 21st, 2019, 10:34 am

Skip Columns in Roster

Post by Nad »

Dear all,

after trying, reading and researching for 4 hours with no results, I need your help.

I have a roster:
With 7 columns for 7 different questions (1. number of men in the household (NUMBER_MEN), 2. number of women in the houshold, 3. total number of persons in the household (TOTAL_PERSONS), 4. disabilities of persons in the household, 5. number of men that work, 6. number of women that work, 7. number of women that are pregnant (WOMEN_PREGNANT)).
And 6 rows for 6 different age groups (a. less than 2 years, b. 2-5 years, 6-12 years, 13-17 years, 18-60 years, 61 years and more) and a 7th line for the total of each question.
What I already did is skipping questions for an age group with no men or women
--> if TOTAL_PERSONS= 0 then
skip to next;
endif;

Now, what I want to do is:
1) skip questions 5,6 and 7 for the age groups a. and b., and start with questions 1 for the next age group
2) skip question 7 for the age groups c. and f., and start with questions 1 for the next age group


For 1) I've tried:
preproc
//Skip to next age group for household members under 6 years of age
if TOTAL_PERSONS(1) > 1 then
skip to NUMBER_MEN(2);
endif;
if TOTAL_PERSONS(2) > 1 then
skip to NUMBER_MEN(3);
endif;

But this only works for row (2), then I get an error message because the program thinks in row (2) that it has to go back to row (2).
I also tried it using skip to next instead of NUMBER_MEN, but then CSPro skips all of the following questions 5 to 7 for every age group and not just for age group a. und b.

For 2) I've tried:

PROC WOMEN_PREGNANT

preproc
//Skip to next age group for women under 13 years of age
if NUMBER_WOMEN(3) > 1 then
skip to NUMBER_MEN(4);
endif;

if NUMBER_WOMEN(6) > 1 then
skip to NUMBER_MEN(7);
endif;

But it happens the same as above. I've also tried skip next instead of NUMBER_MEN. But once NUMBER_WOMEN(3)>1 is true, it skips this question in all of the following age groups

What can I do?

I would be super thankful for any help!

Greetings Nadine
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Skip Columns in Roster

Post by Gregory Martin »

Rather than listing the occurrence numbers to skip to, just skip to the next row at the appropriate moment. Something like this:
PROC NUMBER_MEN_WORKING

preproc

    if curocc() in 1, 2 then
        skip to next;
    endif;

PROC WOMEN_PREGNANT

preproc

    if curocc() in 3, 6 then
        skip to next;
    endif;
Nad
Posts: 3
Joined: February 21st, 2019, 10:34 am

Re: Skip Columns in Roster

Post by Nad »

Thanks so much, it worked!

But now I have a new problem.

Again I have a Roster: This time with 16 lines and three questions per line.

I want to skip lines 5,6,7 and 8 if the answer of the questions 1(Consumo_7Dias) and 3 (Consumo_Ayer) in line 4 is 0.
Also I want to skip lines 10 and 11 if the answer of the questions 1 and 3 in line 9 is 0.
And I want to skip lines 13 if the answer of the questions 1 and 3 in line 12 is 0.

I programmed this logic as a postproc of question 3. But it only works the first time, then again I have an error that my logic is referring to sth. backward in the lfow (Message 91166).
Can someone help me how to programme it correctly?

if M5Q1_CONSUMO_7DIAS(4)= 0 and M5Q3_CONSUMO_AYER(4) = 0 then
skip to M5Q1_CONSUMO_7DIAS(9);
endif;

if M5Q1_CONSUMO_7DIAS(9)= 0 and M5Q3_CONSUMO_AYER(9) = 0 then
move to M5Q1_CONSUMO_7DIAS(12);
endif;

if M5Q1_CONSUMO_7DIAS(12)= 0 and M5Q3_CONSUMO_AYER(12) = 0 then
move to M5Q1_CONSUMO_7DIAS(14);
endif;


Thank yous soo much!
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Skip Columns in Roster

Post by Gregory Martin »

I would write your skips in a preproc, first checking what row you're on. Something like this:
PROC M5Q1_CONSUMO_7DIAS

preproc

    if curroc() = 5 and M5Q1_CONSUMO_7DIAS(4)= 0 and M5Q3_CONSUMO_AYER(4) = 0 then
        skip to M5Q1_CONSUMO_7DIAS(9);

    elseif curocc() = 10 and M5Q1_CONSUMO_7DIAS(9)= 0 and M5Q3_CONSUMO_AYER(9) = 0 then
        move to M5Q1_CONSUMO_7DIAS(12);

    elseif curocc() = 13 and M5Q1_CONSUMO_7DIAS(12)= 0 and M5Q3_CONSUMO_AYER(12) = 0 then
        move to M5Q1_CONSUMO_7DIAS(14);

    endif;
Post Reply