Page 1 of 1

Skip condition involved in more than one "other" in occurrences

Posted: October 12th, 2022, 12:24 am
by sham
Hi family,
I need your guide in relation to the roster below;
group= FRUIT_REC000

VEGID VEGNAME CONSUME SPECIFY AMOUNTSPENT
1 01 Maize 1 15
2 02 Beans 2
3 03 other1 1 Rice 12
4 04 other2 2 //This should have ended the group since no other2
5 05 other3 2

Below is my logic:
PROC VEGID
preproc
$= curocc(OTHERSPECIFY_REC000);

PROC VEGNAME
preproc
$(01)= "Maize";
$(02)= "Yam";
$(03)= "other1";
$(04)= "other2";
$(05)= "other3";

I need a logic to end the group if the 3rd occurrence for consumed is No(2) or if 3rd occurrence in question(Consumed) is yes(1) and 4th occurrence in question(Consumed) is No(2)

This is the logic that I used;
postproc
if curocc(FRUIT_REC000) in 3 and CONSUME= 2 then
endgroup;
endif;

Despite no error in the compiled but I am not achieving the expected action.

I will be glad for your assistance.
Thank you.

Re: Skip condition involved in more than one "other" in occurrences

Posted: October 12th, 2022, 6:31 am
by etuser
please try the following , it might work

Proc CONSUME

if pos ("OTHER", toupper(VEGNAME)) > 0 and $ in 2 then
Endsect;
elseif $ in 2 then
skip to next;
Endif;

Re: Skip condition involved in more than one "other" in occurrences

Posted: October 12th, 2022, 9:02 am
by sham
Hi.
@etuser and Team, I am most grateful for your guide. It is working soo well.

Thank you.