The following statement computes the cumulative sum of the variable X but produces a missing value for all periods after the first missing X value. convert x=y / transformout=( nomiss movave 5 ) The NOMISS operator has no effect unless it is followed by a moving time window operator.įor example, the following statement computes a five-period moving average of the variable X but produces a missing value when any of the five values are missing. The NOMISS operator does not perform any calculations, but serves to modify the operation of the moving time window operator that follows it. When preceded by the NOMISS operator, these functions produce a missing result if any value within the time window is missing. Normally, the moving time window and cumulative statistics operators ignore missing values and compute their results for the nonmissing values. convert x=y / transformout=( cmovave 5 trim 2 ) For example, the following statements compute a centered five-period moving average of X, and they set to missing values at the ends of the series that are averages of fewer than five values.
You can use these functions to trim the results of moving time window operators so that the result series contains only values computed from a full width time window. You can truncate the length of the result series by using the TRIM, TRIMLEFT, and TRIMRIGHT operators to set values to missing at the beginning or end of the series. Look into the options for dealing with missing values in the docs