<?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: Size of array = number of observations in the data set -How to make that work? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98279#M20760</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for the quick reply! This did the trick!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Jun 2013 18:27:46 GMT</pubDate>
    <dc:creator>Kolobok</dc:creator>
    <dc:date>2013-06-06T18:27:46Z</dc:date>
    <item>
      <title>Size of array = number of observations in the data set -How to make that work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98277#M20758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I am new to SAS, to please forgive if this is a rather elementary question.&lt;/P&gt;&lt;P&gt;I have a data set that has lets say 15 observations. I am able to count them using _N_ as well as proc sql count function.&lt;/P&gt;&lt;P&gt;I want to declare an array of the size N where N would be equal to the number of observations...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select count (col1) ;&lt;/P&gt;&lt;P&gt;from dataset1;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array (N) $;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for all you help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 17:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98277#M20758</guid>
      <dc:creator>Kolobok</dc:creator>
      <dc:date>2013-06-06T17:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Size of array = number of observations in the data set -How to make that work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98278#M20759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To do this you have to create a macro variable and the use it in the data step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; select Count(*) into :dim&lt;BR /&gt;&amp;nbsp;&amp;nbsp; from sashelp.class;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;%put &amp;amp;dim;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* statements.... */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array my_array(&amp;amp;dim) $;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* more statements&amp;nbsp; ....&amp;nbsp; */&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 18:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98278#M20759</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2013-06-06T18:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Size of array = number of observations in the data set -How to make that work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98279#M20760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for the quick reply! This did the trick!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 18:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98279#M20760</guid>
      <dc:creator>Kolobok</dc:creator>
      <dc:date>2013-06-06T18:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Size of array = number of observations in the data set -How to make that work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98280#M20761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Obviously count(*) will be the most accurate approach, but it could take some time if doing it on a huge table. Then you could try to get the number of obs from Meta data instead of actually counting it on the fly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('nobs', nobs);&lt;/P&gt;&lt;P&gt;stop;&lt;/P&gt;&lt;P&gt;set sashelp.class nobs=nobs;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put &amp;amp;nobs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select nobs into :nobs from dictionary.tables where libname='SASHELP' AND MEMNAME='CLASS';QUIT;&lt;/P&gt;&lt;P&gt;%put &amp;amp;nobs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 19:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98280#M20761</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-06-06T19:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Size of array = number of observations in the data set -How to make that work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98281#M20762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for your reply Haikuo! I am just learning SAS and I am very happy I found this board!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 20:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-array-number-of-observations-in-the-data-set-How-to-make/m-p/98281#M20762</guid>
      <dc:creator>Kolobok</dc:creator>
      <dc:date>2013-06-06T20:12:31Z</dc:date>
    </item>
  </channel>
</rss>

