<?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: Select Into Separated By in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280550#M56709</link>
    <description>&lt;P&gt;The problem is using '#' instead of #.&amp;nbsp; Macro language doesn't require quotes ... it would treat # as text in any case.&amp;nbsp; Particularly in the case of %SCAN, using '#' as the set of delimiters indicates that either # or a single quote is a delimiter.&amp;nbsp; That would throw off the parsing of the %SCAN function.&amp;nbsp; It would probably throw off the count of COUNTW as well.&amp;nbsp; Just change '#' to #&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jun 2016 18:42:31 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-06-27T18:42:31Z</dc:date>
    <item>
      <title>Select Into Separated By</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280531#M56705</link>
      <description>&lt;P&gt;I have a dataset of records each containing an Oracle SQL string in a variable named Rule. &amp;nbsp;For example here are four of the Rule records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL
NVL(A.ACTUAL_DLVRY_DATE,SYSDATE) &amp;lt;&amp;gt; NVL(B.ACTUAL_DLVRY_DATE,SYSDATE)
A.LAST_SCAN_DATETIME &amp;gt; B.LAST_SCAN_DATETIME
NVL(A.INTER_SCF_EXCL_IND ,'T') &amp;lt;&amp;gt; NVL(B.INTER_SCF_EXCL_IND ,'T')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my program I create a list of these Rules and place them into a macro variable name Rule_List with each Rule separated by the # character.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SYMBOLGEN:  Macro variable RULE_LIST resolves to A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT
            NULL#NVL(A.ACTUAL_DLVRY_DATE,SYSDATE) &amp;lt;&amp;gt; NVL(B.ACTUAL_DLVRY_DATE,SYSDATE)#A.LAST_SCAN_DATETIME &amp;gt;
            B.LAST_SCAN_DATETIME#NVL(A.INTER_SCF_EXCL_IND ,'T') &amp;lt;&amp;gt; NVL(B.INTER_SCF_EXCL_IND ,'T')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However the output of my program gets goofy for the 4th Rule and I can't figure out how to correct it. &amp;nbsp;It's as though it's being split up into 5 different fragmented Rule values. &amp;nbsp;Please, any help would really be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Program:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data QueryRules;&lt;BR /&gt; infile datalines;&lt;BR /&gt; input rule $70.;&lt;BR /&gt; datalines; &lt;BR /&gt;A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL&lt;BR /&gt;NVL(A.ACTUAL_DLVRY_DATE,SYSDATE) &amp;lt;&amp;gt; NVL(B.ACTUAL_DLVRY_DATE,SYSDATE)&lt;BR /&gt;A.LAST_SCAN_DATETIME &amp;gt; B.LAST_SCAN_DATETIME&lt;BR /&gt;NVL(A.INTER_SCF_EXCL_IND ,'T') &amp;lt;&amp;gt; NVL(B.INTER_SCF_EXCL_IND ,'T')&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%macro loopy;&lt;BR /&gt;%local i rule rule_list;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select trim(rule) into : rule_list separated by "#" from QueryRules;&lt;BR /&gt;quit;&lt;BR /&gt;%do i=1 %to %sysfunc(countw(&amp;amp;rule_list,'#'));&lt;BR /&gt; %let rule = %scan(&amp;amp;rule_list, &amp;amp;i,'#');&lt;BR /&gt; %put &amp;amp;rule;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%loopy;&lt;/PRE&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL
NVL(A.ACTUAL_DLVRY_DATE,SYSDATE) &amp;lt;&amp;gt; NVL(B.ACTUAL_DLVRY_DATE,SYSDATE)
A.LAST_SCAN_DATETIME &amp;gt; B.LAST_SCAN_DATETIME
NVL(A.INTER_SCF_EXCL_IND ,
T
) &amp;lt;&amp;gt; NVL(B.INTER_SCF_EXCL_IND ,
T
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 18:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280531#M56705</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-06-27T18:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select Into Separated By</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280536#M56706</link>
      <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;separated &lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"#"&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;maybe?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note : I can't find function NVL in SAS. Did you define your own?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 18:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280536#M56706</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-27T18:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Select Into Separated By</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280539#M56708</link>
      <description>&lt;P&gt;I've tried 'separated by' using many different characters. &amp;nbsp;Doesn't seem to make a difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NVL isn't a SAS function, it's an Oracle function. It's just part of the data being stored in the Rule variable.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 18:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280539#M56708</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-06-27T18:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Select Into Separated By</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280550#M56709</link>
      <description>&lt;P&gt;The problem is using '#' instead of #.&amp;nbsp; Macro language doesn't require quotes ... it would treat # as text in any case.&amp;nbsp; Particularly in the case of %SCAN, using '#' as the set of delimiters indicates that either # or a single quote is a delimiter.&amp;nbsp; That would throw off the parsing of the %SCAN function.&amp;nbsp; It would probably throw off the count of COUNTW as well.&amp;nbsp; Just change '#' to #&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 18:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280550#M56709</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-27T18:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select Into Separated By</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280826#M56819</link>
      <description>Yes! Thank you.</description>
      <pubDate>Tue, 28 Jun 2016 15:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Into-Separated-By/m-p/280826#M56819</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-06-28T15:27:57Z</dc:date>
    </item>
  </channel>
</rss>

