• <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>

Use Hot Decks

Hot decks in CSPro are implemented using Array objects. First, you must declare the array under the PROC GLOBAL section. Then you need to set the initial values for the hot deck array. There are two ways to initialize and maintain arrays in CSPro:
  • inline (in program logic), or
  • using saved arrays.
Once the array has been declared and initialized, you need to add logic to check each occurrence of the variable you wish to impute using the hot deck. If the value of the variable is valid, update the hot deck by assigning this value to the appropriate cell in the array. If the value is invalid, set the value of the variable based on the corresponding cell in the hot deck. A simple usage could be:
Example 1
This example uses the traditional inline method of maintaining hot decks.
PROC GLOBAL

Array HD_Age_SexRel(2, 8);  // hot deck for age, uses sex & relationship as indices

PROC AGE

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

   
else
       
// otherwise:
        // update the value of the hot deck with the good value found
        HD_Age_SexRel(SEX, RELATIONSHIP) = AGE;

   
endif;
Example 2
This example uses the save array method of maintaining hot decks.
PROC GLOBAL

// the hot deck for age uses the sex & relationship value sets
// to define the array dimensions

Array HD_Age_SexRel(SEX_VS, REL_VS) save;

PROC AGE

   
if AGE = notappl then
       
// if the value for age is invalid:
        // assign a valid value from the hot deck based on sex and relationship
        impute(AGE, HD_Age_SexRel());   // no parameters needed for HD_Age_SexRel

   
else
       
// otherwise:
        // update the value of the hot deck with the good value found
        HD_Age_SexRel() = AGE;  // CSPro uses the current value of sex & rel as the indices

   
endif;
When an age is missing during the data file's processing, we will use a value from the array HD_Age_SexRel; when an age is valid, we will "refresh" the age for the person using the current sex and relationship codes as indices into the array.
For a more detailed explanation of what hot decks are, refer to the United Nations Handbook on Population and Housing Census Edits.
See also: Dynamic Imputation (Hot Deck)