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
Two level Dictionary
-
- Posts: 1801
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Two level Dictionary
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:numeric numSecondLevelOccs;
PROC FIRST_LEVEL
preproc
numSecondLevelOccs = 0;
PROC SECOND_LEVEL
preproc
inc(numSecondLevelOccs);
if numSecondLevelOccs > totocc(FIRST_LEVEL_ROSTER) then
endlevel;
endif;
PROC F1
F2 = getlabel(F1,F1);
F2 = getlabel(F1,F1);