Page 1 of 1

Two level Dictionary

Posted: September 11th, 2014, 3:09 pm
by ikwamena
I have a two level dictionary and I want the total count in a roster be the number of occurrence in the second level then you endlevel for the first case.
pls i also want to display a slected value set as as input in the next field. For example Field F1 if the responses is 1=male, i want filed F2 automatically be filled with Male. How can i implement this in my application

Re: Two level Dictionary

Posted: September 29th, 2014, 11:47 am
by Gregory Martin
The Census Bureau does not recommend that people use two-level applications, but if you must, then you will have to write code to keep track of how many second level occurrences have been added, and then endlevel when they match the total count from the roster. For example, this will work in most cases, though you will have issues if the keyer is jumping from entering data in one second-level occurrence to another and then back again. Something like this:
PROC GLOBAL

numeric numSecondLevelOccs;

PROC FIRST_LEVEL

preproc

    numSecondLevelOccs =
0;


PROC SECOND_LEVEL

preproc

    
inc(numSecondLevelOccs);

    
if numSecondLevelOccs > totocc(FIRST_LEVEL_ROSTER) then
        
endlevel;
    
endif;
If you want to fill in F2, an alpha field, with the data from F1, you could write:
PROC F1

    F2 =
getlabel(F1,F1);