<?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: Call to execute Macro without firm ending in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/736344#M229374</link>
    <description>&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very similar follow-up question to my previous question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an unspecified number of tables (AAA1, AAA2, AAA3,...) that I want to transpose, and call them BBB1, BBB2,...etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the same solution to counting my AAA-tables, as suggested by the solution given here previously, which seems to work fine here too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Proc Transpose-part, however does not work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following error messages:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "TRANSP".&lt;BR /&gt;52 data=AAA&amp;amp;no. out=BBB&amp;amp;no. (drop=_name_ _label_); id A; var B;&lt;BR /&gt;____&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for each table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in the end:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From what I understand, this error message is common when missing a semi-colon or similar. I have tried but not been able to fix it. Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro transp;

proc sql noprint;
        select count(memname) into :num from dictionary.tables where libname='WORK' and memtype='DATA'
            and memname eqt "AAA";
quit;

proc transpose
%DO no=1 %TO &amp;amp;num.;
data=AAA&amp;amp;no. out=BBB&amp;amp;no. (drop=_name_ _label_);
id A;
var B;
%END;
run;

%mend;

%transp&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 22 Apr 2021 08:31:54 GMT</pubDate>
    <dc:creator>GustavSandberg</dc:creator>
    <dc:date>2021-04-22T08:31:54Z</dc:date>
    <item>
      <title>Call to execute Macro without firm ending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/721550#M223669</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have, through various steps, created two sets of 4 tables;&lt;/P&gt;&lt;P&gt;BBB1, BBB2, BBB3 and BBB4&lt;/P&gt;&lt;P&gt;CCC1, CCC2, CCC3 and CCC4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish to put these tables together as such:&lt;/P&gt;&lt;P&gt;BBB1 + CCC1 = DDD1&lt;/P&gt;&lt;P&gt;BBB2 + CCC2 = DDD2&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this I have written a macro that works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro sqlloop(start,end);

	PROC SQL;
		%DO no=&amp;amp;start. %TO &amp;amp;end.;
			CREATE TABLE DDD&amp;amp;no. as 
				SELECT * 
				FROM BBB&amp;amp;no., CCC&amp;amp;no.;
		%END;
	QUIT;

%mend;&lt;BR /&gt;&lt;BR /&gt;%sqlloop(start=1, end=4)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is that the previous code will not always create 4 tables. Might be 2, might be 41, it all depends on the input (however, there will always be an equal amount of BBBX-tables and CCCX-tables).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is; How do I write a call for execution of the macro, so that it goes through all tables, without having to manually put an exact number as "end"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Gustav&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 13:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/721550#M223669</guid>
      <dc:creator>GustavSandberg</dc:creator>
      <dc:date>2021-02-24T13:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Call to execute Macro without firm ending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/721555#M223671</link>
      <description>&lt;P&gt;Use SQL to count the number of tables shown which have a name that begins with BBB&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro sqlloop;
    proc sql noprint;&lt;BR /&gt;        select count(memname) into :num from dictionary.tables where libname='WORK' and memtype='DATA'&lt;BR /&gt;            and memname eqt "BBB";&lt;BR /&gt;    quit;
	PROC SQL;
		%DO no=1 %TO &amp;amp;num.;
			CREATE TABLE DDD&amp;amp;no. as 
				SELECT * 
				FROM BBB&amp;amp;no., CCC&amp;amp;no.;
		%END;
	QUIT;
%mend;&lt;BR /&gt;&lt;BR /&gt;%sqlloop&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 13:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/721555#M223671</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-24T13:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Call to execute Macro without firm ending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/721560#M223674</link>
      <description>Thank you very much for your fast answer and solution! It worked perfectly!</description>
      <pubDate>Wed, 24 Feb 2021 13:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/721560#M223674</guid>
      <dc:creator>GustavSandberg</dc:creator>
      <dc:date>2021-02-24T13:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Call to execute Macro without firm ending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/736344#M229374</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very similar follow-up question to my previous question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an unspecified number of tables (AAA1, AAA2, AAA3,...) that I want to transpose, and call them BBB1, BBB2,...etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the same solution to counting my AAA-tables, as suggested by the solution given here previously, which seems to work fine here too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Proc Transpose-part, however does not work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following error messages:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "TRANSP".&lt;BR /&gt;52 data=AAA&amp;amp;no. out=BBB&amp;amp;no. (drop=_name_ _label_); id A; var B;&lt;BR /&gt;____&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for each table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in the end:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From what I understand, this error message is common when missing a semi-colon or similar. I have tried but not been able to fix it. Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro transp;

proc sql noprint;
        select count(memname) into :num from dictionary.tables where libname='WORK' and memtype='DATA'
            and memname eqt "AAA";
quit;

proc transpose
%DO no=1 %TO &amp;amp;num.;
data=AAA&amp;amp;no. out=BBB&amp;amp;no. (drop=_name_ _label_);
id A;
var B;
%END;
run;

%mend;

%transp&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 08:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-execute-Macro-without-firm-ending/m-p/736344#M229374</guid>
      <dc:creator>GustavSandberg</dc:creator>
      <dc:date>2021-04-22T08:31:54Z</dc:date>
    </item>
  </channel>
</rss>

