<?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: first orde autocorrelation in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254946#M2606</link>
    <description>&lt;P&gt;Since you did not provide data, Xia used the DATA step to generate random data.&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#p0gw58qo85qp56n1kbpiz50ww8lv.htm" target="_self"&gt;CALL STREAMINIT&lt;/A&gt; is a DATA step function that is used when generating random numbers. &amp;nbsp;It ensures that two people will see the same set of random values, thus is very useful on discussion forums. &amp;nbsp;You will not need to use that call when you analyze real data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, it is always good practice to provide data (real or fake) when you ask a question. It saves the experts a lot of time and will motivate more people to attempt a solution to&amp;nbsp;your questions.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2016 14:24:51 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-03-07T14:24:51Z</dc:date>
    <item>
      <title>first orde autocorrelation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254896#M2601</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to find the first order autocorrelation of monthly returns for each mainstrategy. This autocorrelation should be calculated based on a 5 year rolling window. I need some help with the approprate code. I have tried others but didnt work.&lt;/P&gt;&lt;P&gt;so I have a data set as such&lt;/P&gt;&lt;P&gt;Date &amp;nbsp; &amp;nbsp; &amp;nbsp; Return &amp;nbsp; &amp;nbsp; AUM &amp;nbsp; &amp;nbsp;mainstrategy&lt;/P&gt;&lt;P&gt;199512 &amp;nbsp; -0.0055 &amp;nbsp; 26.9 &amp;nbsp; &amp;nbsp; Relative value&lt;/P&gt;&lt;P&gt;199601 &amp;nbsp; &amp;nbsp;0.0048 &amp;nbsp; 27.1 &amp;nbsp; &amp;nbsp; &amp;nbsp;Relative value&lt;/P&gt;&lt;P&gt;199602 &amp;nbsp; &amp;nbsp;0.0089 &amp;nbsp; 30.7 &amp;nbsp; &amp;nbsp; &amp;nbsp;CTA&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 08:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254896#M2601</guid>
      <dc:creator>bukky09</dc:creator>
      <dc:date>2016-03-07T08:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: first orde autocorrelation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254903#M2602</link>
      <description>&lt;P&gt;Here is the code you could get start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
call streaminit(1234);
length 	mainstrategy $ 20;
 do mainstrategy='Relative value','CTA';
  do year=1990 to 2010;
   do month=1 to 12;
    date=mdy(month,1,year);
	return=rand('uniform');
    output;
   end;
  end;
 end;
 drop year month ;
 format date yymmn6.;
run;

proc iml;
use have nobs nobs;
read all var{mainstrategy date return};
close;


start_end=t(loc( mainstrategy^=t( {' '}||remove(mainstrategy,nobs) ) ))||
          t(loc( mainstrategy^=t( remove(mainstrategy,1)||{' '}) ) );
corr=j(nobs,1,.);
do i=1 to nrow(start_end);
 do j=start_end[i,1] to start_end[i,2]-1-5*12;
   corr[j,1]=corr(return[j:j+5*12]||return[j+1:j+1+5*12])[2];
 end;
end;

create corr var{corr};
append ;
close;
quit;
data want;
merge have corr;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Mar 2016 09:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254903#M2602</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-07T09:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: first orde autocorrelation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254906#M2603</link>
      <description>Hi,&lt;BR /&gt;Thanks for your reply. I would like to know if the "streaminit (123)" is a standard sas word or it means i should be calling from my own data set</description>
      <pubDate>Mon, 07 Mar 2016 10:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254906#M2603</guid>
      <dc:creator>bukky09</dc:creator>
      <dc:date>2016-03-07T10:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: first orde autocorrelation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254908#M2604</link>
      <description>Thank you very much it work so I guess "streaminit (123)" is a standard word that is part of the code</description>
      <pubDate>Mon, 07 Mar 2016 10:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254908#M2604</guid>
      <dc:creator>bukky09</dc:creator>
      <dc:date>2016-03-07T10:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: first orde autocorrelation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254946#M2606</link>
      <description>&lt;P&gt;Since you did not provide data, Xia used the DATA step to generate random data.&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#p0gw58qo85qp56n1kbpiz50ww8lv.htm" target="_self"&gt;CALL STREAMINIT&lt;/A&gt; is a DATA step function that is used when generating random numbers. &amp;nbsp;It ensures that two people will see the same set of random values, thus is very useful on discussion forums. &amp;nbsp;You will not need to use that call when you analyze real data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, it is always good practice to provide data (real or fake) when you ask a question. It saves the experts a lot of time and will motivate more people to attempt a solution to&amp;nbsp;your questions.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 14:24:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/254946#M2606</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-03-07T14:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: first orde autocorrelation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/255051#M2607</link>
      <description>&lt;P&gt;Please do not post the same the question in multiple locations. It is likely to get multiple similar responses or questions. When the responses are scattered across multiple threads then the solution may not be clear and then the "correct answer" is only attributed to one thread.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the topic is not in an appropriate section of the forum then the thread may be moved to a more appropriate area.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 18:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/first-orde-autocorrelation/m-p/255051#M2607</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-07T18:44:17Z</dc:date>
    </item>
  </channel>
</rss>

