<?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 no:of obs &amp; vars in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/no-of-obs-vars/m-p/119917#M24658</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%macro lib(lib=);&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select memname,nvar,nobs&lt;BR /&gt;into :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m1, :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v1, :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o1 &lt;BR /&gt;from dictionary.tables&lt;BR /&gt;&amp;nbsp; where libname="%upcase(&amp;amp;lib)" and memtype='DATA';&lt;BR /&gt;quit;&lt;BR /&gt;%put _user_;&lt;BR /&gt;%mend lib;&lt;/P&gt;&lt;P&gt;%lib(lib=work)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This macro will give the no;of obs and no:of vars of the 1st dataset in a library...&lt;BR /&gt;But I need to write a macro which gives the no:of obs and no:of vars of all the datasets in a library...Please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Jun 2013 16:58:47 GMT</pubDate>
    <dc:creator>supersonic</dc:creator>
    <dc:date>2013-06-26T16:58:47Z</dc:date>
    <item>
      <title>no:of obs &amp; vars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/no-of-obs-vars/m-p/119917#M24658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%macro lib(lib=);&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select memname,nvar,nobs&lt;BR /&gt;into :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m1, :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v1, :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o1 &lt;BR /&gt;from dictionary.tables&lt;BR /&gt;&amp;nbsp; where libname="%upcase(&amp;amp;lib)" and memtype='DATA';&lt;BR /&gt;quit;&lt;BR /&gt;%put _user_;&lt;BR /&gt;%mend lib;&lt;/P&gt;&lt;P&gt;%lib(lib=work)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This macro will give the no;of obs and no:of vars of the 1st dataset in a library...&lt;BR /&gt;But I need to write a macro which gives the no:of obs and no:of vars of all the datasets in a library...Please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 16:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/no-of-obs-vars/m-p/119917#M24658</guid>
      <dc:creator>supersonic</dc:creator>
      <dc:date>2013-06-26T16:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: no:of obs &amp; vars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/no-of-obs-vars/m-p/119918#M24659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to you want the information formatted?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could put them into those same three macro variables as delimited values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;select memname&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , nvar&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , nobs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp; into :m1 separated by ' '&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , :v1&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; separated by ' '&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , :o1&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; separated by ' '&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Or you could generated multiple variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;select memname&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , nvar&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , nobs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp; into :m1 - :m999999&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , :v1&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; - :v999999&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , :o1&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; - : o999999&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;%let n=&amp;amp;sqlobs;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;There is one difficulty with doing this as a macro since by default to new macro variables will be local to the macro and hence not available when the macro ends.&amp;nbsp; You could force them into the GLOBAL symbol table.&amp;nbsp; In which case it might be easier to do using CALL SYMPUTX.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; if eof then call symputx('n',_N_-1,'G');&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; set sashelp.vtable end=eof;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; where libname = %upcase("&amp;amp;lib") ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; call symputx(cats('m',_n_),memname ,'G') ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;&amp;nbsp; call symputx(cats('v',_n_),nvar ,'G') ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;&amp;nbsp; call symputx(cats('o',_n_),nobs ,'G') ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 17:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/no-of-obs-vars/m-p/119918#M24659</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-06-26T17:21:16Z</dc:date>
    </item>
  </channel>
</rss>

