<?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: proc sql list in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981801#M379192</link>
    <description>Thank you Tom!</description>
    <pubDate>Sun, 11 Jan 2026 19:33:03 GMT</pubDate>
    <dc:creator>SASdevAnneMarie</dc:creator>
    <dc:date>2026-01-11T19:33:03Z</dc:date>
    <item>
      <title>proc sql list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981795#M379188</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;I'm wondering why I got this error using the list :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where datepart(a.ma_date) in (mdy(12,31,year(today())-1), mdy(12,31,year(today())-2), mdy(12,31,year(today())-3),
                                          ___
                                          79
                                          76
ERROR 79-322: Expecting a SELECT.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you for your help !&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jan 2026 16:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981795#M379188</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2026-01-11T16:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981796#M379189</link>
      <description>&lt;P&gt;Please show us the FULL COMPLETE log for this PROC SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, please always (that's 100% of the time, don't wait for us to ask) show us the FULL COMPLETE log for any PROC that gives you an error.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jan 2026 16:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981796#M379189</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-01-11T16:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981797#M379190</link>
      <description>&lt;P&gt;The IN operator in SAS wants a list of VALUES, not function calls.&lt;/P&gt;
&lt;P&gt;The IN operator in SQL also allows a subquery, hence the reference to a missing SELECT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples:&lt;/P&gt;
&lt;PRE&gt; 71         proc sql;
 72         select * from sashelp.class
 73         where age in (13)
 74         ;
 75         quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 76         proc sql;
 77         select * from sashelp.class
 78         where age in (130/10)
                             _
                             22
                             200
 ERROR 22-322: Syntax error, expecting one of the following: a numeric constant, a datetime constant, a missing value, ), ',', -, 
               :.  
 
 ERROR 200-322: The symbol is not recognized and will be ignored.
 
 79         ;
 NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
 80         quit;
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 
 81         proc sql;
 82         select * from sashelp.class
 83         where age in (select age from sashelp.class where age=130/10)
 84         ;
 85         quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;P&gt;Since your functions are not referencing anything that varies you could use the macro language to generate the date constants.&lt;/P&gt;
&lt;P&gt;For example by using %SYSFUNC() to call the SAS functions.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where datepart(a.ma_date) in 
(%sysfunc(intnx(year,%sysfunc(today()),-1,e))
,%sysfunc(intnx(year,%sysfunc(today()),-2,e))
,%sysfunc(intnx(year,%sysfunc(today()),-3,e))
)   &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or just put the dates needed into a macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  length datelist $100;
  do offset=1 to 3 ;
    datelist=catx(' ',datelist,intnx('year',today(),-offset,'e'));
  end;
  call symputx('datelist',datelist);
run;
%put &amp;amp;=datelist;

...
where datepart(a.ma_date) in (&amp;amp;datelist)
...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Jan 2026 17:19:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981797#M379190</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-01-11T17:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981799#M379191</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears you are trying to specify date constants via the use of functions; the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n17vpypuojeg9zn1psc26z2ymju5.htm" target="_blank" rel="noopener"&gt;in operator documentation&lt;/A&gt;&amp;nbsp;specifies:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xisDoc-syntax"&gt;
&lt;DIV class="xisDoc-syntaxDescription"&gt;
&lt;DIV class="xisDoc-requiredArgGroup"&gt;
&lt;DIV id="p0ozgu7i735ouwn1b2u4b3aqk2dl" class="xisDoc-argDescriptionPair"&gt;
&lt;H4 class="xisDoc-argument"&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;constant&lt;/EM&gt;&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;is a number or a quoted character string (or other special notation) that indicates a fixed value. Constants are also called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;literals&lt;/EM&gt;.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="xisDoc-details"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;so that is why there is an error when you use a function, as it is neither a "number or a quoted character string", even though it returns a number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jan 2026 17:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981799#M379191</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2026-01-11T17:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981801#M379192</link>
      <description>Thank you Tom!</description>
      <pubDate>Sun, 11 Jan 2026 19:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-list/m-p/981801#M379192</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2026-01-11T19:33:03Z</dc:date>
    </item>
  </channel>
</rss>

