<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SAS IML: how to create a T x T matrix from a T x 1 vector in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850341#M5926</link>
    <description>&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp;However, to answer your question, you can use the LAG function in SAS IML to create a matrix that contains the lagged effects:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
v = T( 1:10 );       /* input vector */
Lags = lag(v, 0:5);  /* matrix of lags 0,1,2,... */
print Lags;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2022 15:36:59 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2022-12-19T15:36:59Z</dc:date>
    <item>
      <title>SAS IML: how to create a T x T matrix from a T x 1 vector</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850249#M5919</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column vector (1 2 3 ... 20 000). I would like to know how to create&amp;nbsp; a 20 000 x 20 000 matrix which columns correspond to the first column vector I mentioned.&lt;/P&gt;&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2022 14:57:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850249#M5919</guid>
      <dc:creator>_vichz</dc:creator>
      <dc:date>2022-12-18T14:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS IML: how to create a T x T matrix from a T x 1 vector</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850251#M5920</link>
      <description>&lt;P&gt;I think you can use the IML &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/imlug/imlug_langref_sect411.htm" target="_self"&gt;REPEAT statement&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have named the column vector you already have to be X, then you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;want_matrix = repeat(x,1,20000);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Dec 2022 16:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850251#M5920</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-18T16:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: SAS IML: how to create a T x T matrix from a T x 1 vector</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850275#M5921</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;thank you for your answer ! I tried and the following message appeared: "unable to allocate sufficient memory" ...&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2022 22:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850275#M5921</guid>
      <dc:creator>_vichz</dc:creator>
      <dc:date>2022-12-18T22:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAS IML: how to create a T x T matrix from a T x 1 vector</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850317#M5922</link>
      <description>&lt;P&gt;You will need about 3GB to store a 20000x20000 matrix and this is probably more than your default memory allocation for SAS.&amp;nbsp; To see run:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=memsize value;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is a command line option -MEMSIZE that you use when starting the SAS application to increase the allocation.&amp;nbsp; 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.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 08:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850317#M5922</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2022-12-19T08:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS IML: how to create a T x T matrix from a T x 1 vector</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850329#M5923</link>
      <description>&lt;P&gt;I am in complete agreement with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/9374"&gt;@IanWakeling&lt;/a&gt; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437787"&gt;@_vichz&lt;/a&gt;&amp;nbsp;Please explain to us why you need such a huge repetitive matrix. What are you going to do with it?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 11:01:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850329#M5923</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-19T11:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS IML: how to create a T x T matrix from a T x 1 vector</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850338#M5924</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/9374"&gt;@IanWakeling&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, thank you for taking the time to answer my question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_vichz_0-1671451017850.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78712i5A0D9A4C76455F49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="_vichz_0-1671451017850.png" alt="_vichz_0-1671451017850.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 12:00:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850338#M5924</guid>
      <dc:creator>_vichz</dc:creator>
      <dc:date>2022-12-19T12:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS IML: how to create a T x T matrix from a T x 1 vector</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850340#M5925</link>
      <description>&lt;P&gt;If you have a license to SAS/ETS, moving averages can be computed by PROC EXPAND.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/etsug/etsug_expand_details19.htm#etsug_expand001988" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/etsug/etsug_expand_details19.htm#etsug_expand001988&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 12:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850340#M5925</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-19T12:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS IML: how to create a T x T matrix from a T x 1 vector</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850341#M5926</link>
      <description>&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp;However, to answer your question, you can use the LAG function in SAS IML to create a matrix that contains the lagged effects:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
v = T( 1:10 );       /* input vector */
Lags = lag(v, 0:5);  /* matrix of lags 0,1,2,... */
print Lags;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 15:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-how-to-create-a-T-x-T-matrix-from-a-T-x-1-vector/m-p/850341#M5926</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-12-19T15:36:59Z</dc:date>
    </item>
  </channel>
</rss>

