Sum within a roster with a skip
Posted: March 3rd, 2016, 7:49 am
I have a roster with size 20 with purchases of households items and amount.
the list is applicable to all households on their weekly households expenditure.
want to use row (occurrence) 21 as Total amount spent in a week. TThe following are in the roster
HEID Item Description Quantity
1.
2.
3.
21(Total)
I used the following codes to sum the roster for HHID 6
numeric x6a;
x6a = s5a1 + s5a2 + s5a3 + s5a4 + s5a5
if curocc(SEC5A000) = 6 then
if not $(6)= x6a then
errmsg("Check Total. System calculated is %d and What you keyed is %d",x6a,$(6));
reenter
endif;
endif;
The above codes works well. But my challenge is not all households provided for all HEID (6) items thus a keyer have to key zero (0)
throughout even if the household consume an item for the above checks to work. To resolve this issue i introduced this codes
If S5aID in 1:5 and S5A(S5aID) = " " then
skip to HEID(6);
endif;
After it skips all right but my total check does not work again, rather an error message pop up that NOTApp is expected.
Where should introduce the NOTAPP in my codes
the list is applicable to all households on their weekly households expenditure.
want to use row (occurrence) 21 as Total amount spent in a week. TThe following are in the roster
HEID Item Description Quantity
1.
2.
3.
21(Total)
I used the following codes to sum the roster for HHID 6
numeric x6a;
x6a = s5a1 + s5a2 + s5a3 + s5a4 + s5a5
if curocc(SEC5A000) = 6 then
if not $(6)= x6a then
errmsg("Check Total. System calculated is %d and What you keyed is %d",x6a,$(6));
reenter
endif;
endif;
The above codes works well. But my challenge is not all households provided for all HEID (6) items thus a keyer have to key zero (0)
throughout even if the household consume an item for the above checks to work. To resolve this issue i introduced this codes
If S5aID in 1:5 and S5A(S5aID) = " " then
skip to HEID(6);
endif;
After it skips all right but my total check does not work again, rather an error message pop up that NOTApp is expected.
Where should introduce the NOTAPP in my codes