<?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: Help developing a macro with iterations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137576#M27807</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used your code and adjusted it but I am not using into function to show you an example. Adjusting the below code slightly might acheive the results&lt;/P&gt;&lt;P&gt;you are looking for.&lt;/P&gt;&lt;P&gt;data have (drop=j);&lt;BR /&gt; do j=1 to 50;&lt;BR /&gt;&amp;nbsp; k=j;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt; end;&lt;BR /&gt; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%let i=50;&lt;/P&gt;&lt;P&gt;%macro counting;&lt;BR /&gt; %IF &amp;amp;i GT 0 %THEN&lt;BR /&gt;&amp;nbsp; %DO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %do j=1 %to 50;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select count(*) as counting&amp;amp;j. from have;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %end;&lt;BR /&gt;&amp;nbsp; %end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%counting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output is attached for the first 10 and last10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="7360" alt="Capture1.JPG" class="jive-image jiveImage" src="https://communities.sas.com/legacyfs/online/7360_Capture1.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it would be good start&lt;IMG __jive_id="7361" alt="Capture2.JPG" class="jive-image" src="https://communities.sas.com/legacyfs/online/7361_Capture2.JPG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Sep 2014 20:49:24 GMT</pubDate>
    <dc:creator>Hima</dc:creator>
    <dc:date>2014-09-09T20:49:24Z</dc:date>
    <item>
      <title>Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137573#M27804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table with macro variables created throught a proc sql&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql inobs=50;&lt;/P&gt;&lt;P&gt;select trim(testnumber), trim(table) into&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :p1-:p50,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :table1-:tabla50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;from testimportcont;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I'd like to iterate through the table ir order to store new macro variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro counting;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;%do i=1 %to 50;&lt;/P&gt;&lt;P&gt;select count (*) into :counting1-:counting50 from libtest.&amp;amp;tabla&amp;amp;i; &lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it doesn't work and I don't know how to continue....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of my weakness are to work with macros, the other are iterate with variables &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advanced&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 16:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137573#M27804</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-09-09T16:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137574#M27805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are going to try to use macros then you want to learn about the options MPRINT and SYMBOLGEN;&lt;/P&gt;&lt;P&gt;If you run:&lt;/P&gt;&lt;P&gt;options mprint;&lt;/P&gt;&lt;P&gt;before your call to %counting; you would see that the line&lt;/P&gt;&lt;P&gt;select count (*) into :counting1-:counting50 from libtest.&amp;amp;tabla&amp;amp;i;&lt;/P&gt;&lt;P&gt;overwriting your macro variables counting1 to counting50 with each iteration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might want to name the variables&lt;/P&gt;&lt;P&gt;:counting&amp;amp;i._1 - counting&amp;amp;i._50&lt;/P&gt;&lt;P&gt;so you have a different series of macro variables for each value of i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 20:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137574#M27805</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-09-09T20:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137575#M27806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are you actually trying to do? &lt;/P&gt;&lt;P&gt;Converting your data into macro variables and then back into data will probably cause trouble and probably is not necessary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 20:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137575#M27806</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-09-09T20:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137576#M27807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used your code and adjusted it but I am not using into function to show you an example. Adjusting the below code slightly might acheive the results&lt;/P&gt;&lt;P&gt;you are looking for.&lt;/P&gt;&lt;P&gt;data have (drop=j);&lt;BR /&gt; do j=1 to 50;&lt;BR /&gt;&amp;nbsp; k=j;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt; end;&lt;BR /&gt; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%let i=50;&lt;/P&gt;&lt;P&gt;%macro counting;&lt;BR /&gt; %IF &amp;amp;i GT 0 %THEN&lt;BR /&gt;&amp;nbsp; %DO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %do j=1 %to 50;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select count(*) as counting&amp;amp;j. from have;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %end;&lt;BR /&gt;&amp;nbsp; %end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%counting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output is attached for the first 10 and last10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="7360" alt="Capture1.JPG" class="jive-image jiveImage" src="https://communities.sas.com/legacyfs/online/7360_Capture1.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it would be good start&lt;IMG __jive_id="7361" alt="Capture2.JPG" class="jive-image" src="https://communities.sas.com/legacyfs/online/7361_Capture2.JPG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 20:49:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137576#M27807</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2014-09-09T20:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137577#M27808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Hima for your effort but&amp;nbsp; my macro's level is not enought for your code :smileycry::smileycry:, but it's much apreciated for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ballardw, that is not he problem as you can see in the code below &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom, I have to run several test that count observations in various dataset so First I import the results from past days to a dataset, the spreedsheet is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test table descript&amp;nbsp; count&amp;nbsp;&amp;nbsp; date&lt;/P&gt;&lt;P&gt;===&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =====&amp;nbsp;&amp;nbsp; ========&amp;nbsp; =====&amp;nbsp;&amp;nbsp; ====&lt;/P&gt;&lt;P&gt;test1 table1 zzzzzzzz 25 10/09/2014&lt;/P&gt;&lt;P&gt;.... .... .... .. .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm trying to do is take test1 to test 50, table1 to table50, descript1 to descript50 and convert into macro variables throught the proc sql statement select into.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this I'm thinking about get the count value for each test and table and store it in others macrovariables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, with the values of count1-count50 perform a proc sql insert into, into the dataset I imported from excel to acumulate the results of the days and export again to excel file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I have managed the first step with de proc sql I posted in the post above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second step is to count the observations and here is where I locked because when I try to run&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;76&amp;nbsp;&amp;nbsp; %countobs&lt;/P&gt;&lt;P&gt;MLOGIC(COUNTOBS):&amp;nbsp; Beginning execution.&lt;/P&gt;&lt;P&gt;MPRINT(COUNTOBS):&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;MLOGIC(COUNTOBS):&amp;nbsp; %DO loop beginning; index variable I; start value is 1; stop value is 29;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by value is 1.&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "COUNTOBS".&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select count (*) into :counting&amp;amp;i from dmpro.&amp;amp;table.i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference TABLA not resolved.&lt;/P&gt;&lt;P&gt;MPRINT(COUNTOBS):&amp;nbsp;&amp;nbsp; select count (*) into :counting1 from dmpro.&amp;amp;;&lt;/P&gt;&lt;P&gt;ERROR 22-322: Expecting a name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MLOGIC(COUNTOBS):&amp;nbsp; %DO loop index variable I is now 2; loop will iterate again.&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "COUNTOBS".&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select count (*) into :counting&amp;amp;i from dmpro.&amp;amp;table.i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference TABLA not resolved.&lt;/P&gt;&lt;P&gt;MPRINT(COUNTOBS):&amp;nbsp;&amp;nbsp; select count (*) into :counting2 from dmpro.&amp;amp;;&lt;/P&gt;&lt;P&gt;ERROR 22-322: Expecting a name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I write %put _user_ I can see all the tables (from table1 to table50) with its values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 07:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137577#M27808</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-09-10T07:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137578#M27809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All information on the tables are available using either:&lt;/P&gt;&lt;P&gt; - proc contents&lt;/P&gt;&lt;P&gt; - SAShelp.v-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; entries&amp;nbsp; There are many of them. Macro-values libnames and table &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The table entrie wil give you all information on all tables that are open in your sas session. including nobs.&lt;/P&gt;&lt;P&gt;- SAS macro's&amp;nbsp;&amp;nbsp;&amp;nbsp; are able to get it on a single-dataset approach. very handy when to nobs need to be known in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 09:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137578#M27809</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-10T09:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137579#M27810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jaap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I go to sashelp.Vmacro I can see all the macro variables I created with the select into.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that I don't know how to call that macros (table1,table2, and so on)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 10:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137579#M27810</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-09-10T10:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137580#M27811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you go to sashelp.vtable you will see all the tables and their number of observations&lt;BR /&gt;It is a table you can process that as a table.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 10:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137580#M27811</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-10T10:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137581#M27812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure I understand what you want.&amp;nbsp; Perhaps you are saying that you have a list of dataset names and you want to find &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;the number of observations for each of those datasets?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; test $ table $ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;test1 have&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;test2 table2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;a.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;*&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , b.nobs&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have a&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;left&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;join&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dictionary.tables b&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;on&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; b.libname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'WORK'&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; upcase(a.table) = b.memname&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 12:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137581#M27812</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-09-10T12:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137582#M27813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that´s right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Very good answer, clean and easy, but unfortunately it´s doens't work for me because the datasets are not in my local drive, but if in a remote server so I don't see how many observations are in these datasets&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Captura.JPG" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/7367_Captura.JPG" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I said to Jaap in my sashelp.vmacro table I see all the macros I created with the select into: but when I try to access to them but without success&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: I got it. There was a sintax issue, now the code iterates but without stores de results of the query in the macro variables counting1,counting2&amp;nbsp; and so on &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro countobs(table) ;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;%do i=1 %to 29;&lt;/P&gt;&lt;P&gt;select count (*) into :counting&amp;amp;i from dmpro.&amp;amp;&amp;amp;table&amp;amp;i;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPRINT(COUNTOBS):&amp;nbsp;&amp;nbsp; select count (*) into :counting25 from libname.table25;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 14:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137582#M27813</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-09-10T14:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137583#M27814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can submit that code of Tom to your remote session.&lt;BR /&gt;Having a RLS working it will run. Is it an external RDBMS you need to have the count(*) approach.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Some RDBMS are supporting the retrieval of metadata information.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 14:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137583#M27814</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-10T14:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137584#M27815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You still do not need to resort to macro "arrays" or store the counts into macro variables.&lt;/P&gt;&lt;P&gt;Note that if you are storing the count into a macro variable make sure to use a format or it will lose precision for counts that require more than 12 digits.&amp;nbsp; (select count(*) format=18.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;For example you could just store the list of tables into a single macro variable and loop over that and generate UPDATE statements to set the NOBS variable with the COUNT(*) results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; test $ libname $ memname $ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;test1 work have&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;test2 sashelp class&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; nobs=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;STRONG&gt;&lt;EM&gt;test&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; tables i ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;*----------------------------------------------------------------------;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* Count number of observations when NOBS is missing ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;*----------------------------------------------------------------------;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct catx(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'.'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,libname,memname) &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :tables separated by &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'/'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from WANT&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where nobs is missing&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;sqlobs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; update WANT set nobs = &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select count(*) from &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%scan&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(&amp;amp;tables,&amp;amp;i,/))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where catx(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'.'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,libname,memname)=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"%scan(&amp;amp;tables,&amp;amp;i,/)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;test&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 15:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137584#M27815</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-09-10T15:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137585#M27816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Morning all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Tom, it works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only a few questions for us &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry Jaap but I don't know what is RLS. Could you light to me please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom, I've never seen before the statement "&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: blue; background-color: white;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: black; background-color: white;"&gt; tables i ;". Would you explain to me how to use it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2014 07:25:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137585#M27816</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-09-11T07:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137586#M27817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you have SAS running on several servers you can connect those using SAS/connect.&lt;BR /&gt;By doing that you can remote submit SAS-programs between the sas sessions, doing up/down loads and using remote library servers (RLS).&lt;/P&gt;&lt;P&gt;RLS is making the library transparent in a functional way looking at it on the local machine while it on server side.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When you are using SAS/Access to a RDBMS you are also connecting to External data. But in that case is not a SAS session running at the other side.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2014 07:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137586#M27817</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-11T07:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137587#M27818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;Jaap Karman escribió:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;When you have SAS running on several servers you can connect those using SAS/connect.&lt;BR /&gt;By doing that you can remote submit SAS-programs between the sas sessions, doing up/down loads and using remote library servers (RLS).&lt;/P&gt;
&lt;P&gt;RLS is making the library transparent in a functional way looking at it on the local machine while it on server side.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;When you are using SAS/Access to a RDBMS you are also connecting to External data. But in that case is not a SAS session running at the other side.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much Jaap&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2014 09:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137587#M27818</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-09-11T09:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137588#M27819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Here is the code you can use:&lt;/P&gt;&lt;P&gt;/*Creating Datasets*/&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;input name$ emp;&lt;BR /&gt;datalines;&lt;BR /&gt;aaa 121&lt;BR /&gt;bb 232&lt;BR /&gt;ccc 989&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;input name$ emp;&lt;BR /&gt;datalines;&lt;BR /&gt;aaa 121&lt;BR /&gt;ccc 989&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data c;&lt;BR /&gt;input name$ emp;&lt;BR /&gt;datalines;&lt;BR /&gt;aaa 121&lt;BR /&gt;bb 232&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data d;&lt;BR /&gt;input name$ emp;&lt;BR /&gt;datalines;&lt;BR /&gt;aaa 121&lt;BR /&gt;bb 232&lt;BR /&gt;ccc 989&lt;BR /&gt;erf 455&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data testimportcont;&lt;BR /&gt;input testnumber $ table $;&lt;BR /&gt;datalines;&lt;BR /&gt;a1 a&lt;BR /&gt;a2 b &lt;BR /&gt;a3 c &lt;BR /&gt;a4 d &lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;proc sql inobs=50;&lt;BR /&gt;select trim(testnumber), trim(table) into :p1-:p4,:tab1-:tab4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;from testimportcont;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;options mprint mlogic symbolgen;&lt;BR /&gt;%macro counting;&lt;BR /&gt;proc sql;&lt;BR /&gt;%do i=1 %to 4;&lt;BR /&gt;select count(*) into :counting1-:counting4 from &amp;amp;&amp;amp;&amp;amp;tab&amp;amp;i.; &lt;BR /&gt;%end;&lt;BR /&gt;quit;&lt;BR /&gt;%mend;&lt;BR /&gt;%counting;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=====Output=====&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.JPG" class="jive-image" src="https://communities.sas.com/legacyfs/online/7390_Capture.JPG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2014 09:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137588#M27819</guid>
      <dc:creator>damanaulakh88</dc:creator>
      <dc:date>2014-09-11T09:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137589#M27820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%LOCAL will insure that the macro variables are defined in the current macro's symbol table.&amp;nbsp; So changes made to them will not impact any existing macro variables that were created before the macro started running.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2014 11:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137589#M27820</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-09-11T11:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help developing a macro with iterations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137590#M27821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;Tom escribió:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%LOCAL will insure that the macro variables are defined in the current macro's symbol table.&amp;nbsp; So changes made to them will not impact any existing macro variables that were created before the macro started running.&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Tom for share your knowledge with me &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt; and thanks damanaulakh88 for your code, it was my first &lt;SPAN style="color: #000000; font-family: arial, sans-serif; background-color: #ffffff;"&gt;approach&lt;/SPAN&gt; to the problem but for some reason I still don't resolved why the &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;counting1-:counting4&lt;/SPAN&gt; are not store like macro variables, in fact they don't appear when you submit %put _all_ statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know what could be the reason fo it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Sep 2014 09:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-developing-a-macro-with-iterations/m-p/137590#M27821</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-09-12T09:10:58Z</dc:date>
    </item>
  </channel>
</rss>

