<?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: SAS Generate SQL Instructions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Generate-SQL-Instructions/m-p/911998#M359581</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5599"&gt;@foxrol94&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'd like to build a SAS macro programme to generates these SQL instructions on a single line.&amp;nbsp;&lt;BR /&gt;Thanks for your help.&lt;/P&gt;
&lt;PRE&gt;DELETE from LIB_ONE.TEMP_TABLE WHERE DAR='$DAR' AND VLD_ENR =1 AND SOURCE ='OP_Z' AND LET_OPE IN ('LEN','SELL') AND TIC_ENT IN ('107','102') AND ISIN IN ('BE00ZZZ', 'BE00YYYYYYY', 'BE001192XXX');&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suspect there is more to your actual problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But to generate that STATEMENT (lines don't have any importance to either the macro processor or the SQL language) you could just define the macro like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymacro;
DELETE from LIB_ONE.TEMP_TABLE WHERE DAR='$DAR' AND VLD_ENR =1 AND SOURCE ='OP_Z' AND LET_OPE IN ('LEN','SELL') AND TIC_ENT IN ('107','102') AND ISIN IN ('BE00ZZZ', 'BE00YYYYYYY', 'BE001192XXX');
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you could call the macro where ever you want the statement inserted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
 %mymacro
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might want to leave the semicolon out of the body of the macro and instead add it in the program that executes the macro.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 17:59:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-01-18T17:59:16Z</dc:date>
    <item>
      <title>SAS Generate SQL Instructions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Generate-SQL-Instructions/m-p/911992#M359579</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'd like to build a SAS macro programme to generates these SQL instructions on a single line.&amp;nbsp;&lt;BR /&gt;Thanks for your help.&lt;/P&gt;
&lt;PRE&gt;DELETE from LIB_ONE.TEMP_TABLE WHERE DAR='$DAR' AND VLD_ENR =1 AND SOURCE ='OP_Z' AND LET_OPE IN ('LEN','SELL') AND TIC_ENT IN ('107','102') AND ISIN IN ('BE00ZZZ', 'BE00YYYYYYY', 'BE001192XXX');&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Jan 2024 17:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Generate-SQL-Instructions/m-p/911992#M359579</guid>
      <dc:creator>foxrol94</dc:creator>
      <dc:date>2024-01-18T17:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Generate SQL Instructions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Generate-SQL-Instructions/m-p/911994#M359580</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5599"&gt;@foxrol94&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to build a SAS macro programme to generates these SQL instructions on a single line.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Macros create dynamic code, that can change as needed without a human typing new code. What part of this code needs a macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why does the code have to be on a single line?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 17:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Generate-SQL-Instructions/m-p/911994#M359580</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-18T17:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Generate SQL Instructions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Generate-SQL-Instructions/m-p/911998#M359581</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5599"&gt;@foxrol94&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'd like to build a SAS macro programme to generates these SQL instructions on a single line.&amp;nbsp;&lt;BR /&gt;Thanks for your help.&lt;/P&gt;
&lt;PRE&gt;DELETE from LIB_ONE.TEMP_TABLE WHERE DAR='$DAR' AND VLD_ENR =1 AND SOURCE ='OP_Z' AND LET_OPE IN ('LEN','SELL') AND TIC_ENT IN ('107','102') AND ISIN IN ('BE00ZZZ', 'BE00YYYYYYY', 'BE001192XXX');&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suspect there is more to your actual problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But to generate that STATEMENT (lines don't have any importance to either the macro processor or the SQL language) you could just define the macro like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymacro;
DELETE from LIB_ONE.TEMP_TABLE WHERE DAR='$DAR' AND VLD_ENR =1 AND SOURCE ='OP_Z' AND LET_OPE IN ('LEN','SELL') AND TIC_ENT IN ('107','102') AND ISIN IN ('BE00ZZZ', 'BE00YYYYYYY', 'BE001192XXX');
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you could call the macro where ever you want the statement inserted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
 %mymacro
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might want to leave the semicolon out of the body of the macro and instead add it in the program that executes the macro.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 17:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Generate-SQL-Instructions/m-p/911998#M359581</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-18T17:59:16Z</dc:date>
    </item>
  </channel>
</rss>

