My first project here at STC 6 months ago was to translate a spectral theory related code from R to SAS. R has a defined complex type. SAS only has numeric and character variable types. I might be wrong but I did not, at the time, find any way to handle complex numbers naturally in SAS. As such, I had to breakdown my FFT results into 2 matrices, one real and one complex and manually rebuild all subsequent complex processing steps. E.g. if I I needed to multiply FFTA and FFTB matrix results the code would look like tempRe=FFTARe*FFTBRe - FFTAIm*FFTBIm; tempIm=FFTARe*FFTBIm + FFTAIm*FFTBRe; etc. Anyway, you see the point. It looked like a big deal at first but aside from reducing code readability and requiring additionnal commenting to group single logical operations together, it went smoothly. As to answer your question on why the vector is only of size floor(n/2-1). The expected size n vector in R has all the values a+bi and a-bi. Since SAS doesn't support, per say, the complex type, it simply returns a column for a and a column for b. Thus, you can recreate your size n vector by horizontally concatenating FFT[,1]||(-FFT[,2]). The appearent potential truncation has to do with that either even or odd length initial vector will always produce a duplicate (1+0i) value. I can't give more details on the top of my head, it's been too long. Sorry. Good luck! Vincent
... View more