6. Database Tailoring and Retrofitting Techniques › 6.3 Retrofitting Guidelines › 6.3.1 Correcting a File After Creation › 6.3.1.2 Calculated Data Element Correction
6.3.1.2 Calculated Data Element Correction
The simplest correction to values on the database is the
recalculation of calculated data elements, where the data
elements used in the calculation are (by component
definition) on the database, too.
The data element addition illustrated earlier in this chapter
was NCPPCBSY. It was calculated using the actual observation
time and the free cycle time. The statements added to
sharedprefix.MICS.GENLIB(NPAGENIN) were:
...
TYPE C 3 MAPCT. 3 MAPCT. 3 MAPCT.
ALIAS USRPCNPA
NAME NCPPCBSY 00 0 0 0 0 0 3705 Percent Busy
EXP 01 IF NPATMAOT GT 0 THEN
EXP 02 NCPPCBSY = 100 * (NPATMAOT - NCPTMFCT) / NPATMAOT;
EXP 03 ELSE NCPPCBSY = 0;
DEPEND NCPTMFCT NPATMAOT
...
Assume that, originally, there was an error in the MCG EXP
statement content so that the value was calculated
incorrectly. The error might have been the omission of the
100 multiplier, as:
EXP 01 IF NPATMAOT GT 0 THEN
EXP 02 NCPPCBSY = (NPATMAOT - NCPTMFCT) / NPATMAOT;
EXP 03 ELSE NCPPCBSY = 0 ;
The first step in the correction is to fix the EXP 02
statement so that it contains the correct expression:
EXP 02 NCPPCBSY = 100 * (NPATMAOT - NCPTMFCT) / NPATMAOT;
Then rerun the NPACGEN job. This, however, leaves the
existing cycles of the database with bad values in NCPPCBSY.
Therefore, to fix cycle 01 of the DETAIL timespan, the SAS
data statement would look like this:
DATA &TNPAX..NPANCP01 (%NCPFILE(OP=FILEOPTS,TS=DETAIL));
SET &TNPAX..NPANCP01;
IF NPATMAOT GT 0 THEN
NCPPCBSY = 100 * (NPATMAOT - NCPTMFCT) / NPATMAOT;
ELSE NCPPCBSY = 0;
RUN;