EXPAND Procedure

Example 15.3 Interpolating Irregular Observations

(View the complete code for this example.)

This example shows the interpolation of a series of values measured at irregular points in time. The data are hypothetical. Assume that a series of randomly timed quality control inspections are made and defect rates for a process are measured. The problem is to produce two reports: estimates of monthly average defect rates for the months within the period covered by the samples, and a plot of the interpolated defect rate curve over time.

The following statements read and print the input data, as shown in Output 15.3.1:

data samples;
  input date : date9. defects @@;
  label defects = "Defects per 1000 Units";
  format date date9.;
datalines;
13jan1992    55    27jan1992   73    19feb1992   84    8mar1992   69

   ... more lines ...   

title "Sampled Defect Rates";
proc print data=samples;
run;

Output 15.3.1: Measured Defect Rates

Sampled Defect Rates

Obsdatedefects
113JAN199255
227JAN199273
319FEB199284
408MAR199269
527MAR199266
605APR199277
729APR199263
811MAY199281
925MAY199289
1007JUN199294
1123JUN1992105
1211JUL199297
1315AUG1992112
1429AUG199289
1510SEP199277
1627SEP199282


To compute the monthly estimates, use PROC EXPAND with the TO=MONTH option and specify OBSERVED=(BEGINNING,AVERAGE). The following statements interpolate the monthly estimates:

proc expand data=samples
            out=monthly
            to=month
            plots=(input output);
  id date;
  convert defects / observed=(beginning,average);
run;

The following PROC PRINT step prints the results, as shown in Output 15.3.2:

title "Estimated Monthly Average Defect Rates";
proc print data=monthly;
run;

Output 15.3.2: Monthly Average Estimates

Estimated Monthly Average Defect Rates

Obsdatedefects
1JAN199259.323
2FEB199282.000
3MAR199266.909
4APR199270.205
5MAY199282.762
6JUN199299.701
7JUL1992101.564
8AUG1992105.491
9SEP199279.206


The plots produced by PROC EXPAND are shown in Output 15.3.3.

Output 15.3.3: Interpolated Defects Rate Curve

Interpolated Defects Rate Curve
External File:images/expex02c1.png


Last updated: June 19, 2025