<?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: Proc IML creating X matrix with over 1000 variables from dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578947#M164284</link>
    <description>&lt;P&gt;I think you need parentheses and not curly brackets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read ALL var ("var1":"var1000") into x;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 04 Aug 2019 00:54:23 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-08-04T00:54:23Z</dc:date>
    <item>
      <title>Proc IML creating X matrix with over 1000 variables from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578943#M164282</link>
      <description>&lt;P&gt;I'm using SAS 9.4.&lt;/P&gt;&lt;P&gt;I'm new to IML and a little unfamiliar. &amp;nbsp;I have a code that works, however, I am trying to create an X matrix with over 1000 variables (all named the same thing with corresponding numbers at the end). &amp;nbsp;I can't figure out how to enter this in proc iml, as I tried var1-var1000 and var1:var1000 and proc iml does not like the hyphen or colon. Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;iml&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;use&lt;/SPAN&gt; dataset;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;read&lt;/SPAN&gt; ALL &lt;SPAN&gt;var&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;{var1-var1000}&lt;/STRONG&gt; &lt;/FONT&gt;&lt;SPAN&gt;into&lt;/SPAN&gt; x;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;read&lt;/SPAN&gt; all &lt;SPAN&gt;var&lt;/SPAN&gt; {yvar} &lt;SPAN&gt;into&lt;/SPAN&gt; y;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;close&lt;/SPAN&gt; dataset;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;xBar = mean(x); &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;/* save row vector of means */&lt;/P&gt;&lt;P&gt;yBar = mean(y); &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;/* save mean of Y */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;x = x - xBar; &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;/* center X and y; do not add intercept */&lt;/P&gt;&lt;P&gt;y = y - yBar; &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;The rest of the code is irrelevant to my question.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;If I run the code with just a few x variables and state:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&lt;SPAN&gt;read&lt;/SPAN&gt; ALL &lt;SPAN&gt;var&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;{var1 var2 var3}&lt;/STRONG&gt; &lt;/FONT&gt;&lt;SPAN&gt;into&lt;/SPAN&gt; x;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;Then my code runs fine. &amp;nbsp;However, I can't type over 1000 variables. &amp;nbsp;How can I include ALL variables at once into this matrix X?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 00:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578943#M164282</guid>
      <dc:creator>openatom</dc:creator>
      <dc:date>2019-08-04T00:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc IML creating X matrix with over 1000 variables from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578944#M164283</link>
      <description>&lt;P&gt;Why not use the variable list with KEEP= option when telling IML what dataset to use?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
  use dataset(keep=var1-var1000);
  read ALL into x;
  close dataset;
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 00:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578944#M164283</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-04T00:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc IML creating X matrix with over 1000 variables from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578947#M164284</link>
      <description>&lt;P&gt;I think you need parentheses and not curly brackets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read ALL var ("var1":"var1000") into x;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Aug 2019 00:54:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578947#M164284</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-04T00:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc IML creating X matrix with over 1000 variables from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578985#M164294</link>
      <description>&lt;P&gt;Tom has already give you answer .&lt;/P&gt;
&lt;P&gt;And why not post it at IML forum ,since it is a IML question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;iml&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;use&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;dataset(keep=var1-var10000) ;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;read&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ALL&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;_all_&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;into&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;x;&lt;/P&gt;
&lt;P&gt;close;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;use dataset(keep=yvar);&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;read&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;all&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{yvar}&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;into&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;y;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;close&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 11:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-IML-creating-X-matrix-with-over-1000-variables-from-dataset/m-p/578985#M164294</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-08-04T11:44:39Z</dc:date>
    </item>
  </channel>
</rss>

