<?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 Syntax Help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293212#M60960</link>
    <description>&lt;P&gt;Hi. I have two WHEN statements within my Case statement and I'm attempting to enclose part of the When statement in parentheses using SAS contatentation bars, but I'm getting syntax errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		proc sql;
		create table QueryData&amp;amp;ZIP5._&amp;amp;RULE_ORDER_CHAR as
		select DISTINCT %unquote(%str(%')&amp;amp;ANALYSIS_DESC.%str(%')) as rule_nm length = 58, 
					a.actual_dlvry_date as ad_dt, 
					a.imb_code length = 31, 
					&amp;amp;RULE_ORDER as rule_order,
					a.imb_dlvry_zip_5,
					CASE 
						WHEN "("||%scan(&amp;amp;rule_list, 1,#)||")" AND a.RULEFLAG = "-" THEN "&amp;amp;RULE_ORDER"
						WHEN "("||%scan(&amp;amp;rule_list, 2,#)||")" AND a.RULEFLAG = "-" THEN "&amp;amp;RULE_ORDER"
					END as RuleFlag
		from QueryData&amp;amp;ZIP5 as a 
		inner join QueryData&amp;amp;ZIP5 as b 
		on a.imb_code=b.imb_code 
		where a.source="A" and b.source="B" &lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;220                       &amp;amp;RULE_ORDER as rule_order,                     a.imb_dlvry_zip_5,                     CASE
220!               WHEN "("||%scan(&amp;amp;rule_list, 1,#)||")" AND a.RULEFLAG = "-" THEN "&amp;amp;RULE_ORDER"                         WHEN
                                                   --
                                                   22
                                                   76
220! "("||%scan
ERROR 22-322: Syntax error, expecting one of the following: !, &amp;amp;, AND, OR, THEN, |.

ERROR 76-322: Syntax error, statement will be ignored.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can anyone help me to resolve this error?&lt;/P&gt;</description>
    <pubDate>Mon, 22 Aug 2016 18:19:33 GMT</pubDate>
    <dc:creator>buechler66</dc:creator>
    <dc:date>2016-08-22T18:19:33Z</dc:date>
    <item>
      <title>Syntax Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293212#M60960</link>
      <description>&lt;P&gt;Hi. I have two WHEN statements within my Case statement and I'm attempting to enclose part of the When statement in parentheses using SAS contatentation bars, but I'm getting syntax errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		proc sql;
		create table QueryData&amp;amp;ZIP5._&amp;amp;RULE_ORDER_CHAR as
		select DISTINCT %unquote(%str(%')&amp;amp;ANALYSIS_DESC.%str(%')) as rule_nm length = 58, 
					a.actual_dlvry_date as ad_dt, 
					a.imb_code length = 31, 
					&amp;amp;RULE_ORDER as rule_order,
					a.imb_dlvry_zip_5,
					CASE 
						WHEN "("||%scan(&amp;amp;rule_list, 1,#)||")" AND a.RULEFLAG = "-" THEN "&amp;amp;RULE_ORDER"
						WHEN "("||%scan(&amp;amp;rule_list, 2,#)||")" AND a.RULEFLAG = "-" THEN "&amp;amp;RULE_ORDER"
					END as RuleFlag
		from QueryData&amp;amp;ZIP5 as a 
		inner join QueryData&amp;amp;ZIP5 as b 
		on a.imb_code=b.imb_code 
		where a.source="A" and b.source="B" &lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;220                       &amp;amp;RULE_ORDER as rule_order,                     a.imb_dlvry_zip_5,                     CASE
220!               WHEN "("||%scan(&amp;amp;rule_list, 1,#)||")" AND a.RULEFLAG = "-" THEN "&amp;amp;RULE_ORDER"                         WHEN
                                                   --
                                                   22
                                                   76
220! "("||%scan
ERROR 22-322: Syntax error, expecting one of the following: !, &amp;amp;, AND, OR, THEN, |.

ERROR 76-322: Syntax error, statement will be ignored.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can anyone help me to resolve this error?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 18:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293212#M60960</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-08-22T18:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293217#M60964</link>
      <description>&lt;P&gt;There is no need to do concatenation.&lt;/P&gt;&lt;P&gt;You may write:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CASE WHEN (%scan&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;rule_list&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;#&lt;SPAN class="token punctuation"&gt;)) and ...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 18:45:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293217#M60964</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-08-22T18:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293231#M60972</link>
      <description>&lt;P&gt;I'm not sure I see the need for macro code at all:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHEN (scan("&amp;amp;rule_list", 1, "#") AND a.RULEFLAG = "-" THEN "&amp;amp;RULE_ORDER"&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Aug 2016 19:24:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293231#M60972</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-22T19:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293245#M60976</link>
      <description>Thanks for your insight!</description>
      <pubDate>Mon, 22 Aug 2016 19:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-Help/m-p/293245#M60976</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-08-22T19:57:49Z</dc:date>
    </item>
  </channel>
</rss>

