<?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 Cross Correlation using array of macro series in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260769#M13779</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I am new to SAS. I would appreciate it if anyone helps me. I have to write a code that calculates a cross correlation between one fixed variable and 2000 other macro variables and put it all in a table. To do it manually will take&amp;nbsp;a&amp;nbsp;lot of time. How can I create an array of macro variables and then use proc corr command in the loop? Thank you in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yelena&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Apr 2016 16:21:51 GMT</pubDate>
    <dc:creator>yelena</dc:creator>
    <dc:date>2016-04-01T16:21:51Z</dc:date>
    <item>
      <title>Cross Correlation using array of macro series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260769#M13779</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I am new to SAS. I would appreciate it if anyone helps me. I have to write a code that calculates a cross correlation between one fixed variable and 2000 other macro variables and put it all in a table. To do it manually will take&amp;nbsp;a&amp;nbsp;lot of time. How can I create an array of macro variables and then use proc corr command in the loop? Thank you in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yelena&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 16:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260769#M13779</guid>
      <dc:creator>yelena</dc:creator>
      <dc:date>2016-04-01T16:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Cross Correlation using array of macro series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260770#M13780</link>
      <description>&lt;P&gt;Please post some sample data and output.&lt;/P&gt;
&lt;P&gt;Proc corr allows lists of variables so I'm not sure why you're using a macro. You can avoid listing variables if you have naming conventions. Anyways, we need samples of what you're looking for to help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc corr data=have;
var v1;
with v2 - v2000;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Apr 2016 16:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260770#M13780</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-01T16:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cross Correlation using array of macro series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260772#M13781</link>
      <description>&lt;P&gt;I am a little concerned about "2000 macro variables" as proc corr doesn't do much with "macro variables" unless they resolve to data set variable names or proc options.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the macro variables are data set variable names I would suggest something like;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc corr data = yourdataset ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var TheOneVariableName;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; WIth _numeric_;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that would do correlations between your variable and all numeric variables in the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you need to provide a lot more detail about what you are starting with and the desired result.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 16:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260772#M13781</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-01T16:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cross Correlation using array of macro series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260781#M13783</link>
      <description>&lt;P&gt;Thank you, Reeza. My data looks like this:&lt;/P&gt;&lt;P&gt;Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; v1 &amp;nbsp; &amp;nbsp; &amp;nbsp; rGDP &amp;nbsp; &amp;nbsp; &amp;nbsp; nGDP&lt;/P&gt;&lt;P&gt;30Sep2000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.1&lt;/P&gt;&lt;P&gt;31Dec2000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30 &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4.5&lt;/P&gt;&lt;P&gt;31Mar2001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2.1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I fix v1 but want to run cross correlation for other macro variables, like real GDP (rGDP), nominal GDP (nGDP), etc. I tried to create a list of variables separately and then use array but for some reason my code does not run.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data merged_macro2;&lt;BR /&gt;set &amp;amp;merged_macro1;&lt;BR /&gt;array macro(*) &amp;amp;list;&lt;/P&gt;&lt;P&gt;do i = 1 to dim(macro);&lt;BR /&gt;macro(i) = macro(i);&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics on;&lt;BR /&gt;proc corr data=merged_macro2 plots=matrix(histogram);&lt;BR /&gt;var variable(1);&lt;BR /&gt;with macro(2) - macro(dim(macro));&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 17:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260781#M13783</guid>
      <dc:creator>yelena</dc:creator>
      <dc:date>2016-04-01T17:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cross Correlation using array of macro series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260785#M13785</link>
      <description>&lt;P&gt;Thank you very much for your quick reply. I will try to test it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 17:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260785#M13785</guid>
      <dc:creator>yelena</dc:creator>
      <dc:date>2016-04-01T17:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cross Correlation using array of macro series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260786#M13786</link>
      <description>&lt;P&gt;You can't use arrays in Proc corr. You can specify a variable list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example if you use double dashes it includes all variables between the indicated variables. Given your code this is probably what you're looking for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on;
proc corr data=merged_macro2 plots=matrix(histogram);
var v1;
with &amp;amp;list
run;
ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Apr 2016 17:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260786#M13786</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-01T17:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cross Correlation using array of macro series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260797#M13787</link>
      <description>&lt;P&gt;Thank you, Reeza, and everyone, who helped me solve this problem. The code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let macro = ub.test;&lt;BR /&gt;%let list =&lt;BR /&gt;GDP&lt;BR /&gt;FE&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;ods graphics on;&lt;BR /&gt;proc corr data=ub.test plots=matrix(histogram);&lt;BR /&gt;var LGD;&lt;BR /&gt;with &amp;amp;list;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 17:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Cross-Correlation-using-array-of-macro-series/m-p/260797#M13787</guid>
      <dc:creator>yelena</dc:creator>
      <dc:date>2016-04-01T17:46:59Z</dc:date>
    </item>
  </channel>
</rss>

