<?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 Write a Temporary SAS Code for a SQL Query in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Write-a-Temporary-SAS-Code-for-a-SQL-Query/m-p/861840#M340406</link>
    <description>&lt;P&gt;I have this but i cannot put the ending bracket.&lt;/P&gt;&lt;P&gt;Can you please advise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;options symbolgen mprint mlogic merror;
filename code temp;
data _null_;
   file code ;
  set sashelp.class(obs=10);
  if _n_=1 then put  "select name from sashelp.class where name in ("  @;
  else put ',' @;
  str = quote(strip(name),"'");
  put str ;
  if eof then put ");quit;";
run;
%macro tst_code;
proc sql;
%include code ;
%mend tst_code;
%tst_code;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 01 Mar 2023 20:03:39 GMT</pubDate>
    <dc:creator>david27</dc:creator>
    <dc:date>2023-03-01T20:03:39Z</dc:date>
    <item>
      <title>Write a Temporary SAS Code for a SQL Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-a-Temporary-SAS-Code-for-a-SQL-Query/m-p/861840#M340406</link>
      <description>&lt;P&gt;I have this but i cannot put the ending bracket.&lt;/P&gt;&lt;P&gt;Can you please advise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;options symbolgen mprint mlogic merror;
filename code temp;
data _null_;
   file code ;
  set sashelp.class(obs=10);
  if _n_=1 then put  "select name from sashelp.class where name in ("  @;
  else put ',' @;
  str = quote(strip(name),"'");
  put str ;
  if eof then put ");quit;";
run;
%macro tst_code;
proc sql;
%include code ;
%mend tst_code;
%tst_code;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Mar 2023 20:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-a-Temporary-SAS-Code-for-a-SQL-Query/m-p/861840#M340406</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2023-03-01T20:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Write a Temporary SAS Code for a SQL Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-a-Temporary-SAS-Code-for-a-SQL-Query/m-p/861844#M340407</link>
      <description>&lt;P&gt;You didn't provide a variable EOF that should indicate the end of the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  set sashelp.class(obs=10) end=eof;
&lt;/PRE&gt;
&lt;P&gt;The End= assigns end of data to the variable name following the =;&lt;/P&gt;
&lt;P&gt;Without it your code 1) created a variable named EOF&lt;/P&gt;
&lt;P&gt;2) with a missing value&lt;/P&gt;
&lt;P&gt;and missing is never true so that put never occurred.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 20:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-a-Temporary-SAS-Code-for-a-SQL-Query/m-p/861844#M340407</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-01T20:12:03Z</dc:date>
    </item>
  </channel>
</rss>

