<?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: %let catx call execute in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451040#M113644</link>
    <description>&lt;P&gt;You reset &amp;amp;table1 each time the macro is called&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; table1&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To solve this remove &lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macrostatement"&gt;%global&lt;/SPAN&gt; table1 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; table1&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;from the macro and put them before the data-step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even better: use dictionary.tables, as suggested by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following code is untested, because i don't know what you have in dataset "vcol":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Apr 2018 12:00:52 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2018-04-04T12:00:52Z</dc:date>
    <item>
      <title>%let catx call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451026#M113639</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;DIV class="tw-swapa"&gt;&amp;nbsp;I want to have the list of tables&amp;nbsp; that do not contain data with this method.&lt;/DIV&gt;&lt;DIV class="tw-swapa"&gt;A can't make the "retain" of the macro variable table1&lt;/DIV&gt;&lt;DIV class="tw-swapa"&gt;Thank you for your help.&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro tab(mem=);
%global table1 ;
%let table1=;
%local table;
%let table=;
%let dsid  = %sysfunc(open(&amp;amp;mem.,in));
%let nbr   = %sysfunc(attrn(&amp;amp;dsid,nobs));
%if &amp;amp;nbr.=0 %THEN %do; 
%let table =&amp;amp;mem.;
%let table1=%sysfunc(catx('-',&amp;amp;table,&amp;amp;table1));
%end;
%if &amp;amp;dsid. &amp;gt; 0 %then 
&lt;BR /&gt;&lt;BR /&gt;%let rc = %sysfunc(close(&amp;amp;dsid));
%mend tab;


DATA _null_;
SET vcol;
call execute('%tab(mem='||strip(memname)||');');
run;

%Put table1=&amp;amp;table1;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 11:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451026#M113639</guid>
      <dc:creator>mansour_ibrahim</dc:creator>
      <dc:date>2018-04-04T11:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: %let catx call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451036#M113642</link>
      <description>&lt;OL&gt;
&lt;LI&gt;why not retrieve the nobs from dictionary.tables?&lt;/LI&gt;
&lt;LI&gt;do this&amp;nbsp;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table1=&amp;amp;table.-&amp;amp;table1;&lt;/CODE&gt;&lt;/PRE&gt;
&amp;nbsp;instead of
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table1=%sysfunc(catx('-',&amp;amp;table,&amp;amp;table1));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 04 Apr 2018 11:45:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451036#M113642</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-04T11:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: %let catx call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451040#M113644</link>
      <description>&lt;P&gt;You reset &amp;amp;table1 each time the macro is called&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; table1&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To solve this remove &lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macrostatement"&gt;%global&lt;/SPAN&gt; table1 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; table1&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;from the macro and put them before the data-step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even better: use dictionary.tables, as suggested by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following code is untested, because i don't know what you have in dataset "vcol":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451040#M113644</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-04-04T12:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: %let catx call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451043#M113647</link>
      <description>&lt;P&gt;unable to add the missing code to my last post, so here it is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
   select MemName
      into :table1 separated by '-'
      from sashelp.vtable
         where nobs = 0 and MemName in (
            select MemName from work.vcol
         )
   ;
quit;

%put &amp;amp;=table1;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/let-catx-call-execute/m-p/451043#M113647</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-04-04T12:01:48Z</dc:date>
    </item>
  </channel>
</rss>

