• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
      • Introduction to Batch Editing
      • Create a Batch Edit Application
      • Order of Editing
      • Correcting Errors
      • How to ...
        • Manipulate Automatic Reports
        • Create a Specialized Report
        • Use Hot Decks
        • Initialize Hot Decks in Program Logic
        • Initialize Hot Decks Using Saved Arrays
        • Interpret Reports
        • Run Production Batch Edits
      • Steps in Developing a Batch Editing Program
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Initialize Hot Decks Using Saved Arrays

In this technique, the hot deck is initialized by running the program twice and using the results of the first run to initialize the hot deck for the second run. The array is declared using the save keyword. No initialization of the array is done in the program logic. The program is run twice. During the first run of the program, the array has not been initialized so it is likely that some imputations from the hot deck will use these uninitialized values. The results (the output file) from the first run of the program are therefore discarded. However, during the first run of the program, the hot deck is filled with valid values. Since the array has been declared as a saved array, these values are written to the saved arrays file. When the program is run a second time, these values are read from the saved array file and used as initial values from the array. The advantage of this approach over initializing the array in the program logic is that all values used in the hot deck are taken from the data file.
The following example uses a saved array to initialize a hot deck:
PROC GLOBAL

// declare an array initialized from the saved array file
Array AgeSRDeck(2,6) save;

PROC AGE

   
if AGE = notappl then
       
// if the value for age is not valid...
        // assign the value from the hot deck based on sex and relationship
        impute(AGE,AgeSRDeck(SEX,RELATIONSHIP));

   
else
       
// otherwise...
        // update the value of the hot deck
        AgeSRDeck(SEX,RELATIONSHIP) = AGE;

   
endif;
See also: Dynamic Imputation (Hot Deck), Use Hot Decks, Initialize Hot Decks in Program Logic