<?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: re: macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/re-macro/m-p/403326#M98006</link>
    <description>&lt;P&gt;1. You should use PROC DATASETS or SASHELP.VTABLE instead to process all instead of one at a time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your current code, you forgot the %LET in front of the line with the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Oct 2017 19:16:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-10-11T19:16:51Z</dc:date>
    <item>
      <title>re: macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-macro/m-p/403325#M98005</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi...I am trying to run the proc contents procedure on a number of datasets. The list of names for the datasets are selected from List2. I only want to run the proc contents for each dataset name that is stored in the tablelist. I have attached part of the log output at the end of the code. Any suggestion why I am getting the error. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
	select distinct
		count(tbl)
		into : countlist separated by ' '
	from work.List2
	where List2.ct &amp;gt; 0;
quit;

%put &amp;amp;countlist;

proc sql noprint;
	select distinct
		tbl
		into : tablelist separated by ' '
	from work.List2
	where List2.ct &amp;gt; 0;
quit;

%put &amp;amp;tablelist;
%macro list1;
%local i;
%do i=1 %to &amp;amp;countlist;
%let Dn=%scan(&amp;amp;tablelist,&amp;amp;i);
	LTable="&amp;amp;Dn";

proc contents data=sqldb.&amp;amp;LTable varnum details;
run;

%end;
%mend;
%list1;

Log output:

1         %list1;
NOTE: Line generated by the invoked macro "LIST1".
71          LTable="&amp;amp;Dn";
            ______
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent symbolic reference LTABLE not resolved.
&amp;amp;LTable
WARNING: Apparent symbolic reference LTABLE not resolved.
NOTE 137-205: Line generated by the invoked macro "LIST1".
71          proc contents data=sqldb.&amp;amp;LTable varnum details; run;
                                     _
                                     22
ERROR 22-322: Syntax error, expecting one of the following: ;, (, CENTILES, DATA, DETAILS, DIR, DIRECTORY, FMTLEN, LIB, MEMTYPE, 


              MT, MTYPE, NODETAILS, NODS, NOPRINT, ORDER, OUT, OUT2, SHORT, VARNUM. &lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Oct 2017 19:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-macro/m-p/403325#M98005</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2017-10-11T19:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: re: macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-macro/m-p/403326#M98006</link>
      <description>&lt;P&gt;1. You should use PROC DATASETS or SASHELP.VTABLE instead to process all instead of one at a time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your current code, you forgot the %LET in front of the line with the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 19:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-macro/m-p/403326#M98006</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-11T19:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: re: macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-macro/m-p/403329#M98007</link>
      <description>&lt;P&gt;Hi Reeza.....thanks for the quick response. The missing %let was the problem...thanks once again.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 19:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-macro/m-p/403329#M98007</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2017-10-11T19:29:36Z</dc:date>
    </item>
  </channel>
</rss>

