Wavelet Analysis
Using Symbolic Names
Several of the wavelet subroutines take options vectors that specify user input. For example, the third argument in a WAVFT subroutine call is an options vector that specifies which wavelet and which boundary treatment to use in computing the wavelet transform. You could write the following statements to define the options vector:
optn = j(1, 4, .);
optn[1] = 0;
optn[3] = 1;
optn[4] = 3;
A problem with such code is that it is not easily readable. You can improve readability by using symbolic names. SAS macro variables provide a convenient mechanism for creating such symbolic names. For example, the previous statements could be replaced by the following statements, which use symbolic macro variables (names with a preceding ampersand) to resolve the relevant quantities:
optn = &waveSpec;
optn[&boundary] = &zeroExtension;
optn[&family] = &daubechies;
optn[&member] = 3;
Symbolic names also improve code readability when they are substituted for integer arguments that control which actions a multipurpose subroutine performs. Consider the following statements:
call wavget(n, decomposition, 1);
call wavget(fWavelet, decomposition, 8);
These statements can be replaced by the following:
call wavget(n, decomposition, &numPoints);
call wavget(fWavelet, decomposition, &fatherWavelet);
A set of symbolic names is defined in the autocall WAVINIT macro. The following tables list the symbolic names that are defined in this macro.
Table 1: Macro Variables for Wavelet Specification
| Position | Admissible Values | ||
|---|---|---|---|
| Name | Value | Name | Value |
| &boundary | 1 | &zeroExtension | 0 |
| &periodic | 1 | ||
| &polynomial | 2 | ||
| &reflection | 3 | ||
| &antisymmetricReflection | 4 | ||
| °ree | 2 | &constant | 0 |
| &linear | 1 | ||
| &quadratic | 2 | ||
| &family | 3 | &daubechies | 1 |
| &symmlet | 2 | ||
| &member | 4 | 1 - 10 | |
Table 2: Macro Variables for Threshold Specification
| Position | Admissible Values | ||
|---|---|---|---|
| Name | Value | Name | Value |
| &policy | 1 | &none | 0 |
| &hard | 1 | ||
| &soft | 2 | ||
| &garrote | 3 | ||
| &method | 2 | &absolute | 0 |
| &minimax | 1 | ||
| &universal | 2 | ||
| &sure | 3 | ||
| &sureHybrid | 4 | ||
| &nhoodCoeffs | 5 | ||
| &value | 3 | positive real | |
| &levels | 4 | &all | -1 |
| positive integer | |||
Table 3: Symbolic Names for the Third Argument of WAVGET
| Name | Value |
|---|---|
| &numPoints | 1 |
| &detailCoeffs | 2 |
| &scalingCoeffs | 3 |
| &thresholdingStatus | 4 |
| &specification | 5 |
| &topLevel | 6 |
| &startLevel | 7 |
| &fatherWavelet | 8 |
Table 4: Macro Variables for the Second Argument of WAVPRINT
| Name | Value |
|---|---|
| &summary | 1 |
| &detailCoeffs | 2 |
| &scalingCoeffs | 3 |
| &thresholdedDetailCoeffs | 4 |
Table 5: Macro Variables for Predefined Wavelet Specifications
| Name | &boundary | °ree | &family | &member | ||
|---|---|---|---|---|---|---|
| &waveSpec | { | . | . | . | . | } |
| &haar | { | &periodic | . | &daubechies | 1 | } |
| &daubechies3 | { | &periodic | . | &daubechies | 3 | } |
| &daubechies5 | { | &periodic | . | &daubechies | 5 | } |
| &symmlet5 | { | &periodic | . | &symmlet | 5 | } |
| &symmlet8 | { | &periodic | . | &symmlet | 8 | } |
Table 6: Macro Variables for Predefined Threshold Specifications
| Name | &policy | &method | &value | &levels | ||
|---|---|---|---|---|---|---|
| &threshSpec | { | . | . | . | . | } |
| &RiskShrink | { | &hard | &minimax | . | &all | } |
| &VisuShrink | { | &soft | &universal | . | &all | } |
| &SureShrink | { | &soft | &sureHybrid | . | &all | } |