PROC GLOBAL
numeric i;
array aCodMuni(153); //Códigos de municipio para el set de valores
array alpha(40) aNomMuni(153); //Nombres de municipio en el arreglo
PROC LBZIKA1_DIC_FF
PROC DEPTO
PREPROC
LF_DEP = DEPTO;
if loadcase(AREADIC_DICT, LF_DEP) = 0 then
errmsg("Departamento No existe, please reenter");
MOVE DEPTO;
endif;
do varying i = 1 until i > noccurs(AREADIC_DICT.AREADIC_REC)
aCodMuni(i-1) = LF_MUNI(i);
aNomMuni(i-1) = LF_NMUNI(i);
enddo;
aCodMuni(i-1) = notappl;
setvalueset(MUNI, aCodMuni, aNomMuni);
The problem is that AREADIC_REC is a singly occurring record. In the dictionary the MAX is set to 1. Change the MAX to maximum number of municipo you have in a departmento. Also, the item LF_MUNI should NOT an be an id-item in your dictionary. It should be part of the record. The only id-item in AREADIC should be LF_DEPTO.