<?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: two proc sql in macro loop in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806136#M40513</link>
    <description>&lt;P&gt;Please turn on the macro debugging option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then run your code again and SHOW US the log. We need to see the ENTIRE log for this macro, with nothing chopped out, every single line for this macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66123iA4EF494F9CA0F6EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2022 19:48:26 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-04-05T19:48:26Z</dc:date>
    <item>
      <title>two proc sql in macro loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806134#M40512</link>
      <description>&lt;P&gt;hi to all, i want to create a loop using two proc sql with macro variable in sas guide.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i try this but cant compile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%MACRO SQLLLOP;&lt;BR /&gt;%DO FECHA=22646 %TO&amp;nbsp; 22650;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE WORK.TEST_TABLE&amp;amp;FECHA.&amp;nbsp; AS&lt;BR /&gt;SELECT&lt;/P&gt;&lt;P&gt;t1.V1,&lt;BR /&gt;t1.SEX,&lt;BR /&gt;t1.V2&lt;/P&gt;&lt;P&gt;FROM DATA_HAVE;&lt;/P&gt;&lt;P&gt;WHERE t1.V1 = &amp;amp;FECHA.;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;/* OTHER PROC SQL*/&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE WORK.GROUP_TABLE&amp;amp;FECHA.&amp;nbsp; AS&lt;/P&gt;&lt;P&gt;SELECT t1.SEX,&lt;/P&gt;&lt;P&gt;COUNT(t1.V1) AS TOTAL,&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp; WORK.TEST_TABLE&amp;amp;FECHA.&lt;/P&gt;&lt;P&gt;GROUP BY t1.SEX;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;%END&lt;/P&gt;&lt;P&gt;%MEND;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 20:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806134#M40512</guid>
      <dc:creator>Andres_Fuentes1</dc:creator>
      <dc:date>2022-04-05T20:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: two proc sql in macro loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806136#M40513</link>
      <description>&lt;P&gt;Please turn on the macro debugging option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then run your code again and SHOW US the log. We need to see the ENTIRE log for this macro, with nothing chopped out, every single line for this macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66123iA4EF494F9CA0F6EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 19:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806136#M40513</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-05T19:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: two proc sql in macro loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806138#M40514</link>
      <description>&lt;P&gt;A Proc SQL Create Table&amp;nbsp; or Select statement has exactly one ;&amp;nbsp; at the end. Remove the highlighted one below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AND supply the Alias: &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE WORK.TEST_TABLE&amp;amp;FECHA. AS&lt;BR /&gt;SELECT&lt;/P&gt;
&lt;P&gt;t1.V1,&lt;BR /&gt;t1.SEX,&lt;BR /&gt;t1.V2&lt;/P&gt;
&lt;P&gt;FROM DATA_HAVE &lt;FONT color="#339966"&gt;&lt;STRONG&gt;AS T1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="6" color="#FF0000"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;WHERE t1.V1 = &amp;amp;FECHA.;&lt;/P&gt;
&lt;P&gt;QUIT;&lt;/P&gt;
&lt;P&gt;/* OTHER PROC SQL*/&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;/P&gt;
&lt;P&gt;CREATE TABLE WORK.GROUP_TABLE&amp;amp;FECHA. AS&lt;/P&gt;
&lt;P&gt;t1.SEX,&lt;/P&gt;
&lt;P&gt;COUNT(t1.V1) AS TOTAL,&lt;/P&gt;
&lt;P&gt;FROM WORK.TEST_TABLE&amp;amp;FECHA.&lt;FONT color="#339966"&gt;&lt;STRONG&gt; AS T1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;GROUP BY t1.SEX;&lt;/P&gt;
&lt;P&gt;QUIT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 20:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806138#M40514</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-05T20:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: two proc sql in macro loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806143#M40515</link>
      <description>&lt;P&gt;In your 2nd PROC SQL, you are missing a SELECT&lt;/P&gt;&lt;P&gt;CREATE TABLE WORK.GROUP_TABLE&amp;amp;FECHA.&amp;nbsp; AS&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;t1.SEX,&lt;/P&gt;&lt;P&gt;COUNT(t1.V1) AS TOTAL, ...&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 20:08:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806143#M40515</guid>
      <dc:creator>Michael_Harper</dc:creator>
      <dc:date>2022-04-05T20:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: two proc sql in macro loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806144#M40516</link>
      <description>Sorry, i forgot copy that, but thats not the problem. i'm ediing the post.</description>
      <pubDate>Tue, 05 Apr 2022 20:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806144#M40516</guid>
      <dc:creator>Andres_Fuentes1</dc:creator>
      <dc:date>2022-04-05T20:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: two proc sql in macro loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806151#M40517</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/386950"&gt;@Andres_Fuentes1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sorry, i forgot copy that, but thats not the problem. i'm ediing the post.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Save your self some work. Submit the code for compilation. Then go to the LOG and copy the submitted code along with all the notes, messages and errors. Then on the forum open a text box using the &amp;lt;/&amp;gt; icon at the top of the message window and paste the copied text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That way there is NO question about what was actually submitted. When you retype stuff all sorts of other errors and problems appear that hide the actual problem with your code. The LOG does not lie. It may confuse on occasion but doesn't lie.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 20:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806151#M40517</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-05T20:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: two proc sql in macro loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806164#M40518</link>
      <description>&lt;P&gt;The macro will not compile because the %END statement is missing the closing semicolon.&lt;/P&gt;
&lt;P&gt;The SAS code the macro is generating is gibberish also but it is the mistake with the %END statement that is causing the macro not be compiled.&lt;/P&gt;
&lt;PRE&gt;1162  %MACRO SQLLLOP;
1163  %DO FECHA=22646 %TO  22650;
1164  PROC SQL;
1165  CREATE TABLE WORK.TEST_TABLE&amp;amp;FECHA.  AS
1166  SELECT
1167
1168  t1.V1,
1169  t1.SEX,
1170  t1.V2
1171
1172  FROM DATA_HAVE;
1173
1174  WHERE t1.V1 = &amp;amp;FECHA.;
1175
1176  QUIT;
1177
1178  /* OTHER PROC SQL*/
1179
1180  PROC SQL;
1181
1182  CREATE TABLE WORK.GROUP_TABLE&amp;amp;FECHA.  AS
1183
1184  SELECT t1.SEX,
1185
1186  COUNT(t1.V1) AS TOTAL,
1187
1188  FROM  WORK.TEST_TABLE&amp;amp;FECHA.
1189
1190  GROUP BY t1.SEX;
1191
1192  QUIT;
1193
1194  %END
1195
1196  %MEND;
NOTE: Extraneous text on %END statement ignored.
&lt;/PRE&gt;
&lt;P&gt;Since the %END statement "ate" the %MEND statement you need to submit another one.&amp;nbsp; Or restart your SAS session and try again.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 21:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/two-proc-sql-in-macro-loop/m-p/806164#M40518</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-05T21:53:10Z</dc:date>
    </item>
  </channel>
</rss>

