Add-Innovation Home

About Add-Innovation

Contact Us

  SAS Institute logo.    SUBSETTING IF STATEMENTS.

These statements subset the input data according to the test applied. If the test does not return True, then the current record is deleted and the next one processed. When used against an input file, the statements should be applied individually so that the least likely test are applied first.

e.g.

Data Demised(Drop=CessReas BusRes);
    Infile InstMast;
    Input @50 CessReas $1. @;
    If CessReas=’E’;            /* Customer Deceased */
    Input @48 BusRes   $1. @;
    If BusRes=’1’;            /* Residential only */
    Input @1 District  $2. @;
    If District NE ‘NI’;        /* None Northern Ireland */
    Input @3 InstId    $12.@;

The above example returns all UK Mainland dead residential customers. Specifying the cessation reason first eliminates more installations than the following tests, so the statements following that are processed less frequently.
Note also that CessReas and the BusRes variables are dropped. Since we know what the value of those variables are on every observation, it is a waste of space to include them.