<?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: Problem with array dimension when is a macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850749#M336200</link>
    <description>Yea, i got a problem with teh data step of definition.&lt;BR /&gt;With a proc sql&lt;BR /&gt;proc sql; select cats(nvar) into :nvars from sashelp.vtable where memname=’ABT_DUMMY’;&lt;BR /&gt;proc sql; select cats(nobs) into :obs from sashelp.vtable where memname=’ABT_DUMMY’;&lt;BR /&gt;Works well, the problem was the symput and the blanks. Thanks.</description>
    <pubDate>Thu, 22 Dec 2022 09:03:32 GMT</pubDate>
    <dc:creator>rodbriv</dc:creator>
    <dc:date>2022-12-22T09:03:32Z</dc:date>
    <item>
      <title>Problem with array dimension when is a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850741#M336196</link>
      <description>&lt;P&gt;Hi, i have a problem with the dimension definiton of an array. My code works good in SAS Guide, but in the bash does't works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The macro variables nvars and obs are definited as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set sashelp.vtable (where= (memname='ABT_DUMMY'));&lt;/P&gt;&lt;P&gt;&amp;nbsp;call symput('nvars', nvar-1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;call symput('obs', nobs);&lt;/P&gt;&lt;P&gt;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish to put the macros in array dimension:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data bt_lambda (keep= var dot);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array xx[&amp;amp;nvars.] x_1-x_&amp;amp;nvars.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array xd[&amp;amp;obs., &amp;amp;nvars.] _temporary_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;But return the errors:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="train.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78806iE811418CD592C61B/image-size/large?v=v2&amp;amp;px=999" role="button" title="train.png" alt="train.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works if i defined the macros as:&lt;/P&gt;&lt;P&gt;%let nvars=23;&lt;/P&gt;&lt;P&gt;%let obs=84000;&lt;/P&gt;&lt;P&gt;But i need the dynamical dimension. Someone can tell me a solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 08:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850741#M336196</guid>
      <dc:creator>rodbriv</dc:creator>
      <dc:date>2022-12-22T08:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with array dimension when is a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850742#M336197</link>
      <description>&lt;P&gt;The log shows that "nvars" is -1 not 23. Using call symputx is recommended, so that blanks are automatically stripped from the macro-variable.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 08:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850742#M336197</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-12-22T08:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with array dimension when is a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850746#M336198</link>
      <description>&lt;P&gt;First of all, use CALL SYMPUTX instead of CALL SYMPUT. SYMPUTX strips leading and trailing blanks.&lt;/P&gt;
&lt;P&gt;It looks as if your dataset does not contain any variables (resulting in nvars being -1, which is an invalid dimension for the array).&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 08:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850746#M336198</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-22T08:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with array dimension when is a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850749#M336200</link>
      <description>Yea, i got a problem with teh data step of definition.&lt;BR /&gt;With a proc sql&lt;BR /&gt;proc sql; select cats(nvar) into :nvars from sashelp.vtable where memname=’ABT_DUMMY’;&lt;BR /&gt;proc sql; select cats(nobs) into :obs from sashelp.vtable where memname=’ABT_DUMMY’;&lt;BR /&gt;Works well, the problem was the symput and the blanks. Thanks.</description>
      <pubDate>Thu, 22 Dec 2022 09:03:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850749#M336200</guid>
      <dc:creator>rodbriv</dc:creator>
      <dc:date>2022-12-22T09:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with array dimension when is a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850750#M336201</link>
      <description>Yea, i got a problem with teh data step of definition.&lt;BR /&gt;With a proc sql&lt;BR /&gt;proc sql; select cats(nvar) into :nvars from sashelp.vtable where memname=’ABT_DUMMY’;&lt;BR /&gt;proc sql; select cats(nobs) into :obs from sashelp.vtable where memname=’ABT_DUMMY’;&lt;BR /&gt;Works well, the problem was the symput and the blanks. Thanks.</description>
      <pubDate>Thu, 22 Dec 2022 09:03:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-array-dimension-when-is-a-macro-variable/m-p/850750#M336201</guid>
      <dc:creator>rodbriv</dc:creator>
      <dc:date>2022-12-22T09:03:41Z</dc:date>
    </item>
  </channel>
</rss>

