<?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: Array or loop to check range of values in several columns in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Array-or-loop-to-check-range-of-values-in-several-columns/m-p/177371#M45403</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First you may need to check whether the format does what you expect as shown in your post. Did you mean to have a range of values '111'&amp;nbsp; -&amp;nbsp; '123' or only looking for the long string 111-123?&lt;/P&gt;&lt;P&gt;I suspect the first. If so value of '12' and&amp;nbsp; '1200' will be formatted as 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you have something missing such as a ; to end the format (possibly a typo with the single quote) and the existing ; before the other should not be there. Also there should not be a space between the $ the name of the format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you might want display what you expect the output to look like.&lt;/P&gt;&lt;P&gt;Also&lt;/P&gt;&lt;P&gt;If CODE_1 = '111' OR Code_2 = '111'&lt;/P&gt;&lt;P&gt;is perfectly acceptable SAS code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Feb 2015 20:56:21 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-02-20T20:56:21Z</dc:date>
    <item>
      <title>Array or loop to check range of values in several columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-or-loop-to-check-range-of-values-in-several-columns/m-p/177370#M45402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I have a dataset as such:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pat_ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code_1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code_2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code_3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code_4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code_5&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&lt;/P&gt;&lt;P&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 121&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 155&lt;/P&gt;&lt;P&gt;C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 155&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&lt;/P&gt;&lt;P&gt;D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&lt;/P&gt;&lt;P&gt;E&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 155&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 666&lt;/P&gt;&lt;P&gt;F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 332&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a proc format specifying the range of values that I want to match Code_1 = 1, or else = 0 and then I would sort the observations with Code_1 matching my proc format in one table and the ones that don't match in another (in my example using match as the variable).&amp;nbsp; Is there a method to write an array or loop to check for each range of codes I want against Code_2, Code_3?&amp;nbsp; The condition would be say If CODE_1 = '111' OR Code_2 = '111' not AND.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;proc format;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;value $ match&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;'111-123' = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;155 = 1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;.....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;other = 0'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;data pat_codes2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;set pat_codes1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;match=put(Code_1, $match.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Feb 2015 19:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-or-loop-to-check-range-of-values-in-several-columns/m-p/177370#M45402</guid>
      <dc:creator>pinkyc</dc:creator>
      <dc:date>2015-02-20T19:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Array or loop to check range of values in several columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-or-loop-to-check-range-of-values-in-several-columns/m-p/177371#M45403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First you may need to check whether the format does what you expect as shown in your post. Did you mean to have a range of values '111'&amp;nbsp; -&amp;nbsp; '123' or only looking for the long string 111-123?&lt;/P&gt;&lt;P&gt;I suspect the first. If so value of '12' and&amp;nbsp; '1200' will be formatted as 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you have something missing such as a ; to end the format (possibly a typo with the single quote) and the existing ; before the other should not be there. Also there should not be a space between the $ the name of the format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you might want display what you expect the output to look like.&lt;/P&gt;&lt;P&gt;Also&lt;/P&gt;&lt;P&gt;If CODE_1 = '111' OR Code_2 = '111'&lt;/P&gt;&lt;P&gt;is perfectly acceptable SAS code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Feb 2015 20:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-or-loop-to-check-range-of-values-in-several-columns/m-p/177371#M45403</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-02-20T20:56:21Z</dc:date>
    </item>
  </channel>
</rss>

