<?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: Searching Across Variables CPT Codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Searching-Across-Variables-CPT-Codes/m-p/707994#M217480</link>
    <description>&lt;P&gt;Show example input your HAVE data.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Dec 2020 21:11:31 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2020-12-23T21:11:31Z</dc:date>
    <item>
      <title>Searching Across Variables CPT Codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-Across-Variables-CPT-Codes/m-p/707961#M217464</link>
      <description>&lt;P&gt;I have a dataset that contains procedure codes ranging from 1 to 12 (cpt_code1-cpt_code12), that were performed on the same day. I need to search across these variables for specific codes that are related to a specific test being carried on on a patient.&lt;/P&gt;&lt;P&gt;The codes related to each procedure are listed below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test1: 81507, 84702&lt;/P&gt;&lt;P&gt;Test2: 84163, 84702, 76813&lt;/P&gt;&lt;P&gt;Test3: 82677, 84702, 86336&lt;BR /&gt;Test4: 82105, 84702, 86336, 82677&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Note that&amp;nbsp; all the codes listed for each test need to exist in the same row (i.e.cpt_code1-cpt_code12) for that test to be valid. In other words, let's say for a specific person, their row only contains cpt code 81507, I wouldn't be able to classify them as receiving Test1 since cpt code 84702 is not included in that line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried searching previous forums (and reading about arrays) but I can't seem to find anything that matches my situation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a snippet of what I have so far:&lt;/P&gt;&lt;PRE&gt;data work.example2;&lt;BR /&gt;length test_type $20.;&lt;BR /&gt;set work.example;&lt;BR /&gt;array acpt_code(1:12) cpt_code1-cpt_code12;&lt;BR /&gt;do i=1 to 12;&lt;BR /&gt;if acpt_code[i] in ('81507', '84702') then test_type="Test1";	&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;I know the above code is not correct since I'm just telling SAS to search across the variables to see if at least one of the cpt codes exist, and I need to know that both codes exist in order for Test1 to be assigned as the test type (which is where I'm stuck).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 19:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-Across-Variables-CPT-Codes/m-p/707961#M217464</guid>
      <dc:creator>kingsii24</dc:creator>
      <dc:date>2020-12-23T19:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Searching Across Variables CPT Codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-Across-Variables-CPT-Codes/m-p/707994#M217480</link>
      <description>&lt;P&gt;Show example input your HAVE data.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 21:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-Across-Variables-CPT-Codes/m-p/707994#M217480</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2020-12-23T21:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Searching Across Variables CPT Codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-Across-Variables-CPT-Codes/m-p/708009#M217489</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299307"&gt;@kingsii24&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just adapt the program code to the logic and search for those specific &lt;EM&gt;codes&lt;/EM&gt; in the &lt;EM&gt;array&lt;/EM&gt; (and not vice versa), for example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if '81507' in acpt_code &amp;amp; '84702' in acpt_code then test_type="Test1";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 21:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-Across-Variables-CPT-Codes/m-p/708009#M217489</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-12-23T21:41:05Z</dc:date>
    </item>
  </channel>
</rss>

