Difference between skip and advance
Posted: April 27th, 2012, 2:19 pm
I have read the CSPro help about advance and skip but I am still not clear about it. Can you explain what the difference is between the advance and skip statements?
A place to discuss the Census and Survey Processing System
https://www.csprousers.org/forum/
The critical difference between the two comes down to two things:The skip statement skips to the specified field. If the field has multiple occurrences, either record or item, the occurrence number must be specified to skip to the correct occurrence.
The advance statement moves forward field-by-field to the specified field, executing preprocs and postprocs as it goes. It acts as though the Enter key were pressed repeatedly until either the specified field appears or one of the procedures executed during the advance goes to a different field.
On the other hand, with an advance, all of the events that occur between the fields are executed. This means that there must be data already located in the fields that you're advancing past (or notappl has to be accepted for the field). As the help document says, the advance command is equivalent to continually pressing Enter to advance to the next field, until the target is reached. In the above example, if the skip was changed to an advance, and assuming that there was valid data located in VAL1 and VAL2, the output would be:VAL1: preproc
VAL1: killfocus
VAL3: preproc
VAL3: onfocus
How the data will appear in the data fileVAL1: preproc
VAL1: onfocus
VAL1: killfocus
VAL1: postproc
VAL2: preproc
VAL2: onfocus
VAL2: killfocus
VAL2: postproc
VAL3: preproc
VAL3: onfocus