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

Discussions about CSEntry
Post Reply
sham
Posts: 71
Joined: February 3rd, 2022, 7:30 pm

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

Post 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.
You do not have the required permissions to view the files attached to this post.
etuser
Posts: 99
Joined: September 3rd, 2019, 5:57 am

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

Post 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;
sham
Posts: 71
Joined: February 3rd, 2022, 7:30 pm

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

Post by sham »

Hi.
@etuser and Team, I am most grateful for your guide. It is working soo well.

Thank you.
Post Reply