<?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: question about array in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209080#M51819</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Post some test data of have and want.&amp;nbsp; Your code will not work as is, i.e. first off array one is not assigned anything, in the second array dim() does not de-reference like a macro variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Mar 2015 15:41:39 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-03-24T15:41:39Z</dc:date>
    <item>
      <title>question about array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209079#M51818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,below is my SAS code that cause error: "ERROR: Missing numeric suffix on a numbered variable list (b_1-b_dim)".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;set sasuser.class;&lt;/P&gt;&lt;P&gt;array one(*) _CHARACTER_ ;&lt;/P&gt;&lt;P&gt;/*I want array two have same dimension as array one,but i can't*/&lt;/P&gt;&lt;P&gt;array two(*) b_1-b_dim(one);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;George&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 15:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209079#M51818</guid>
      <dc:creator>GeorgeSAS</dc:creator>
      <dc:date>2015-03-24T15:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: question about array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209080#M51819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Post some test data of have and want.&amp;nbsp; Your code will not work as is, i.e. first off array one is not assigned anything, in the second array dim() does not de-reference like a macro variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 15:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209080#M51819</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-03-24T15:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: question about array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209081#M51820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot do that.&amp;nbsp; You could make it a two step process using a macro variable to remember the information from the first step.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data _null_;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set sasuser.class;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;array one(*) _CHARACTER_ ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;call symputx('DIM',dim(one);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;stop;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data test;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set sasuser.class;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;array one(*) _CHARACTER_ ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;/*I want array two have same dimension as array one,but i can't*/&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;array b_ (&amp;amp;dim) ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 15:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209081#M51820</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-24T15:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: question about array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209082#M51821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The answer to your question is more complex than you might imagine.&amp;nbsp; First, here are the principles involved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DATA step operates in two phases.&amp;nbsp; First, the software checks through all your DATA step statements, checks for syntax errors, and performs the set-up work (such as setting up storage locations for each variable).&amp;nbsp; Once that is complete, it enters the second phase, which is actually executing your statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DIM function executes in phase 2, when all the DATA step statements are executing.&amp;nbsp; But the software needs to know how many elements are in the array as part of phase 1 (set-up).&amp;nbsp; So the DIM function doesn't execute in time, generating the error in phase 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution is not particularly lengthy.&amp;nbsp; Set up an initial DATA step to capture the number of elements in the array, then use that number later.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set sasuser.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array one{*} _character_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call symputx('n_cvars', dim(one));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in the second DATA step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array two {&amp;amp;n_cvars} b_1 - b_&amp;amp;n_cvars;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hope this is clear enough.&amp;nbsp; Good luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom, you're fast.&amp;nbsp; Looks like great minds think alike.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 15:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/question-about-array/m-p/209082#M51821</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-03-24T15:47:07Z</dc:date>
    </item>
  </channel>
</rss>

