In reply to Peter MacKay.

Thanks for writing. Unfortunately, the code you pasted does not compile so I cannot comment on it. However, if you are interested in Wavelet analysis, I encourage you to loot at the WAVFT and WAVIFT functions in SAS IML software. Regarding your IML code, I would encourage you to move away from macro and use the programming features in IML to produce code that is more readable. Since you can create user-defined modules in IML, there is rarely a need to use the macro language as part of a numerical computation.