Stop entering same value for variable more than two time
Posted: October 16th, 2015, 10:13 am
Dear Josh,
In my household roster, I wanted to make sure that each household head can have only two parent. So, I used a numeric variable in my
PROC GLOBAL: numberParents = 0; then
// Using a numeric variable (defined in PROC GLOBAL), make sure that each head of household can have only two parents.
if s1q6 = 10 then // parent
if numberParents = 3 then
errmsg("You cannot add a third parent to the household");
reenter;
else
inc(numberParents);
endif;
endif;
Sometimes, I get the error message during data entry even if 10 was entered for s1q6 once. I wanted a situation that the error pops up when you enter 10 for s1q6 more than twice for a given record for the household roster. Is there any other walk around this so that when attempt to enter 10 for s1q6 three time for any given record for the roster the error pops up. Attached is a copy of my survey for your attention.
In my household roster, I wanted to make sure that each household head can have only two parent. So, I used a numeric variable in my
PROC GLOBAL: numberParents = 0; then
// Using a numeric variable (defined in PROC GLOBAL), make sure that each head of household can have only two parents.
if s1q6 = 10 then // parent
if numberParents = 3 then
errmsg("You cannot add a third parent to the household");
reenter;
else
inc(numberParents);
endif;
endif;
Sometimes, I get the error message during data entry even if 10 was entered for s1q6 once. I wanted a situation that the error pops up when you enter 10 for s1q6 more than twice for a given record for the household roster. Is there any other walk around this so that when attempt to enter 10 for s1q6 three time for any given record for the roster the error pops up. Attached is a copy of my survey for your attention.