Hot decks in CSPro are implemented using arrays. 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. For example:
if AGE = notappl then
// if the value for age is not valid...
// assign the value from the hot deck based on sex and relationship
// update the value of the hot deck
AgeSRDeck(SEX,RELATIONSHIP) = AGE;
When an age is missing during the data file's processing, we will use a value from the array AgeSRDeck; if the age is present, we will "refresh" the age for the person using the current sex and relationship codes as indices into the array.