<?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: Matching values to a list in another file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480834#M124296</link>
    <description>&lt;P&gt;You can add as many of the subqueries as you like:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as 
  select ...
  from   have
  where diagnosis_code_t in (select code from codelist)&lt;BR /&gt;     or abc in (...);
quit;&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 Jul 2018 15:29:54 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-07-24T15:29:54Z</dc:date>
    <item>
      <title>Matching values to a list in another file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480823#M124289</link>
      <description>&lt;P&gt;I'm working with medical claims data, and I need to identify claims that contain certain diagnosis, procedure, or revenue codes.&amp;nbsp; In the past, I've used the following approach with short lists of codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF DIAGNOSIS_CODE_t in ("3991","3390")
 OR PRCDR_CDt in ("70450","70460","70470","70480","70481","70482","8703")
 OR UB_92_REV_CD in ("350","351","352","353","354","355","356","357","358","359")

    THEN IMGPROC=1;    ELSE IMGPROC=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, the project I'm working on now involves thousands of codes that are stored in another file .&amp;nbsp; I've tried using PROC SQL to match the files on the desired variables, but that gets to be unwieldy because I have to do 3 different matches and then combine the files:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
	Create table temp.IMG_ATH_qual_CTMRI_DX_match
		as Select a.*, b.*
	From temp.IMG_ATH_qual_DX_flag_recs_DXT2 a LEFT JOIN temp.HA_Tables b
	ON a.DIAGNOSIS_CODE_t = b.DX_code_HA_Table2;
QUIT;

PROC SQL;
	Create table temp.IMG_ATH_qual_CTMRI_pr_match
		as Select a.*, b.*
	From temp.IMG_ATH_qual_DX_flag_recs_procT2 a LEFT JOIN temp.HA_Tables b
	ON a.PRCDR_CODE = b.proc_code_HA_Table2;
QUIT;

PROC SQL;
	Create table temp.IMG_ATH_qual_CTMRI_rev_match
		as Select a.*, b.*
	From temp.IMG_ATH_qual_DX_flag_recs_revT2 a LEFT JOIN temp.HA_Tables b
	ON a.REVENUE_CODE = b.rev_code_HA_Table2;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there are way to do something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF DIAGNOSIS_CODE_t in (~~list of values in variable DX_code_HA_Table2 in file HA_Tables~~ )
 OR PRCDR_CDt in (~~list of values in variable proc_code_HA_Table2 in file HA_Tables~~)
 OR UB_92_REV_CD in (~~list of values in variable rev_code_HA_Table2 in file HA_Tables~~)

    THEN IMGPROC=1;    ELSE IMGPROC=0;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480823#M124289</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2018-07-24T15:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values to a list in another file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480826#M124291</link>
      <description>&lt;P&gt;Yes, put your codes in a dataset, then sub-qeury that:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as 
  select ...
  from   have
  where diagnosis_code_t in (select code from codelist);
quit;&lt;BR /&gt;or&lt;BR /&gt;proc sql;&lt;BR /&gt;  create table want as&lt;BR /&gt;  select  ...,&lt;BR /&gt;          case when diagnosis_code_t in (select code from codelist) then 1 else 0 end as result&lt;BR /&gt;  from    have;&lt;BR /&gt;quit;&lt;/PRE&gt;
&lt;P&gt;Please avoid coding in mixed or all upper case, it makes reading code very hard.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480826#M124291</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-07-24T15:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values to a list in another file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480828#M124293</link>
      <description>&lt;P&gt;My concern with that approach is that I still have to generate 3 different files which then have to be combined, whereas the approach from my first example only requires 1 file.&amp;nbsp; The files can be quite large, so the first approach offers significant time savings.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480828#M124293</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2018-07-24T15:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values to a list in another file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480834#M124296</link>
      <description>&lt;P&gt;You can add as many of the subqueries as you like:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as 
  select ...
  from   have
  where diagnosis_code_t in (select code from codelist)&lt;BR /&gt;     or abc in (...);
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:29:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/480834#M124296</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-07-24T15:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values to a list in another file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/481644#M124621</link>
      <description>&lt;P&gt;I didn't know you could that... it worked well.&amp;nbsp; Thanks! &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 18:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-values-to-a-list-in-another-file/m-p/481644#M124621</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2018-07-26T18:48:40Z</dc:date>
    </item>
  </channel>
</rss>

