<?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: Array without knowing it size in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Array-without-knowing-it-size/m-p/297153#M62370</link>
    <description>&lt;PRE&gt;
You can grab that magic number ,and apply it into ARRAY.

%let dsid=%sysfunc(open(sashelp.class));
%let nvar=%sysfunc(attrn(&amp;amp;dsid,nvars));
%let dsid=%sysfunc(close(&amp;amp;dsid));

%put &amp;amp;nvar ;

&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Sep 2016 11:08:36 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-09-08T11:08:36Z</dc:date>
    <item>
      <title>Array without knowing it size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-without-knowing-it-size/m-p/297008#M62322</link>
      <description>&lt;P&gt;Hello SAS users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After looking and looking, I can't find an efficient solution. My problem is I have to stay in a &lt;STRONG&gt;one and unique dataset. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The length of the array will change so it cannot be a number define.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The length of the array always be length1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only solution I found it's define a big number to have my 11 new variables.&lt;/P&gt;&lt;P&gt;Please find an example of code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test ;&lt;BR /&gt;length1=11;&lt;BR /&gt;array psc00013_trans_amount{0:99999} 3.;&lt;BR /&gt;do i=1 to length1;&lt;BR /&gt;psc00013_trans_amount{i} = 0 ;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help, I'm totally lost.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2016 16:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-without-knowing-it-size/m-p/297008#M62322</guid>
      <dc:creator>alorenzo</dc:creator>
      <dc:date>2016-09-07T16:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Array without knowing it size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-without-knowing-it-size/m-p/297013#M62323</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/103181"&gt;@alorenzo&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello SAS users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After looking and looking, I can't find an efficient solution. My problem is I have to stay in a &lt;STRONG&gt;one and unique dataset. &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The length of the array will change so it cannot be a number define&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The length of the array always be length1.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need to clarify what you mean by those two statments. Where does the value for length1 come from? &lt;/P&gt;
&lt;P&gt;Is the purpose of this exercise to make a data set with one row of data of a specified number of variables all with value 0?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may also be able to set the definition of the values to 0 at creation without the do loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that since you have set the lower bound on your array as 0 in the definition then the loop going from 1 to length1 will not assign a value to the zero element.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2016 16:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-without-knowing-it-size/m-p/297013#M62323</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-07T16:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Array without knowing it size</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-without-knowing-it-size/m-p/297153#M62370</link>
      <description>&lt;PRE&gt;
You can grab that magic number ,and apply it into ARRAY.

%let dsid=%sysfunc(open(sashelp.class));
%let nvar=%sysfunc(attrn(&amp;amp;dsid,nvars));
%let dsid=%sysfunc(close(&amp;amp;dsid));

%put &amp;amp;nvar ;

&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2016 11:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-without-knowing-it-size/m-p/297153#M62370</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-08T11:08:36Z</dc:date>
    </item>
  </channel>
</rss>

