I have a column vector (1 2 3 ... 20 000). I would like to know how to create a 20 000 x 20 000 matrix which columns correspond to the first column vector I mentioned.
Thank you 🙂
You will need about 3GB to store a 20000x20000 matrix and this is probably more than your default memory allocation for SAS. To see run:
proc options option=memsize value; run;
There is a command line option -MEMSIZE that you use when starting the SAS application to increase the allocation. Alternatively, describe why you need to create such a large matrix, and what you want to do with it, then perhaps someone can suggest a way of doing it that needs less memory.
First of all, thank you for taking the time to answer my question 🙂
I have to compute the moving average of a financial time series in order to detrend it. Here, G is the density of a gaussian (mean=0, standard deviation=10). I thought I could do that using matrices. Initially, I took the whole time series (approximately 20 000 observations). Now I sampled it and took the "interesting" part (500 observations).
If you have a license to SAS/ETS, moving averages can be computed by PROC EXPAND.
It is unlikely that the value at time t=20000 times series is related to the value at t=1. Typically, correlations are observed for small time values such as 1-7 (daily), 30 (monthly), or maybe 365 (annually). It might be that you are sampling too frequently (eg, microseconds) and you should decrease the sampling rate.
Most time series procedures in SAS create the lagged effects internally, so there is rarely a need to create a matrix whose columns are the lagged effects. However, to answer your question, you can use the LAG function in SAS IML to create a matrix that contains the lagged effects:
proc iml; v = T( 1:10 ); /* input vector */ Lags = lag(v, 0:5); /* matrix of lags 0,1,2,... */ print Lags;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.