<?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: How to compare a value with a list stored in another file? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198579#M37206</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use proc format, or proc sql;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select 'variable'&lt;/P&gt;&lt;P&gt;into :prefixlist&lt;/P&gt;&lt;P&gt;separated by ','&lt;/P&gt;&lt;P&gt;from table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you a macro variable &amp;amp;prefixlist&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Jul 2015 15:54:24 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2015-07-08T15:54:24Z</dc:date>
    <item>
      <title>How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198578#M37205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have files that include a variable that lists diagnosis codes associated with various medical specialties.&amp;nbsp; I need to compare values from another file to determine if a given record included a diagnosis that matched the medical specialty.&amp;nbsp; I've been copying and pasting the list directly into the syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF DX in ("03282","03640"....) THEN cardiology_flag = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works but is unwieldy and difficult to update.&amp;nbsp; There are 10 specialties with 800-2500 codes each!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The list is stored in a file named as such: DXcodes_cardiology.sas7bdat.&amp;nbsp; There are 2 variables in this file that contain valid codes, named DX_5A and DX_5B.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So how do I get SAS to look at a record in a file called DXcardiology._spec_cat.sas7bdat, and compare the the value stored in the variable DX to the list of codes in the variables DX_5A and DX_5B in DXcodes_cardiology.sas7bdat, and then give the variable cardiology_flag a value 1 if the code is present in the list, and a value of 0 if it's not present in the list?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 15:35:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198578#M37205</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2015-07-08T15:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198579#M37206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use proc format, or proc sql;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select 'variable'&lt;/P&gt;&lt;P&gt;into :prefixlist&lt;/P&gt;&lt;P&gt;separated by ','&lt;/P&gt;&lt;P&gt;from table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you a macro variable &amp;amp;prefixlist&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 15:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198579#M37206</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-08T15:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198580#M37207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If this isn't helpful provide an example, two datasets, of what you have and what you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 16:40:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198580#M37207</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-08T16:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198581#M37208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I highly recommend formats, especially if you already have it in a table.&amp;nbsp; You can use the data set to create the format and then apply it to the dx field.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 17:01:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198581#M37208</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-08T17:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198582#M37209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is how I understand your issue and a possibly solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* dummy data set as I think your look up table looks like*/&lt;BR /&gt;data DXcodes_cardiology;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat DX_5A DX_5B $10.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input DX_5A DX_5B;&lt;BR /&gt;datalines;&lt;BR /&gt;10023 00456&lt;BR /&gt;156&amp;nbsp;&amp;nbsp; 34567&lt;BR /&gt;abc&amp;nbsp;&amp;nbsp; def&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* reshape and prepare for use to create an informat*/&lt;/P&gt;&lt;P&gt;data cariocntl;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set DXcodes_cardiology end=last;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; fmtname='CariologyFlag';&lt;BR /&gt;&amp;nbsp;&amp;nbsp; type='I';&lt;BR /&gt;&amp;nbsp;&amp;nbsp; label='1';&lt;BR /&gt;&amp;nbsp;&amp;nbsp; start= DX_5A; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; start= DX_5B; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if last then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start='**OTHER**';&amp;nbsp; /* special indicator that values not listed treated this way*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label='0';&amp;nbsp;&amp;nbsp;&amp;nbsp; /* this is zero, value for informat not listed valeus*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HLO = 'O';&amp;nbsp;&amp;nbsp;&amp;nbsp; /* this is capital o and is instruction on how to treat others */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* create the format, best would be to place it in a permanent library and point the format search path to include that library*/&lt;/P&gt;&lt;P&gt;proc format library=work cntlin=cariocntl;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* and a quick example of how to use*/&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; input code $;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; CariologyFlag = input(code,CariologyFlag.);&lt;BR /&gt;datalines;&lt;BR /&gt;10023&lt;BR /&gt;156&amp;nbsp; &lt;BR /&gt;abc&amp;nbsp; &lt;BR /&gt;00456&lt;BR /&gt;34567&lt;BR /&gt;def&lt;BR /&gt;211111&lt;BR /&gt;19045&lt;BR /&gt;pdq&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 17:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198582#M37209</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-07-08T17:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198583#M37210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let's make up some data a try it.&lt;/P&gt;&lt;P&gt;data specialties ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input dx $5. specialty $32. ;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;03282Cardiology&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;03640Cardiology&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;data cases;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt; input id dx $5. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;1 03282&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;2 04567&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;proc sql ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt; create table want as &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&amp;nbsp; select a.*,b.specialty&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&amp;nbsp; from cases a left join specialties b &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&amp;nbsp; on a.dx = b.dx &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 18:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198583#M37210</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-08T18:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198584#M37211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark, I certainly like your approach, but I'm not sure what you mean by providing an example of the datasets.&amp;nbsp; I don't see any way to upload them here, and even if I could, they have sensitive info and cannot be shared publicly.&amp;nbsp; I tried to post some screenshots (with the sensitive variables removed) but the forum won't allow me to upload them.&amp;nbsp; They're well below the 2MB filesize limit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, I was able to upload some screenshots.&amp;nbsp; The "card list" file shows the list of diagnosis codes (variables DX_5A and DX_5B) that are associated with Cardiology.&amp;nbsp; The "card claims" file shows actual patient records, including the diagnosis codes (variable DX) associated with each record. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output file should show each record as it exists in the "card claims" file, except that there should be a flag variable (cardiology_flag) indicating whether the diagnosis code for that record is considered to be cardiology-related in the "card list" file. &lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10950iCA5F639F712F1FB4/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="card list.jpg" title="card list.jpg" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10951i2DD863C0D69D520F/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="card claims.jpg" title="card claims.jpg" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 17:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198584#M37211</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2015-07-09T17:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198585#M37212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dummy data that mimics the behavior of your data is sufficient and only needs enough of the variables involved to test all the basic rules you need. A data step with an input and datalines is preferred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example in the post I had previously to make and use an informat from data I had to start with a dummy data as you hadn't really provided much detail. That should provide a skeleton of how to post code to create a dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 19:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198585#M37212</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-07-09T19:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198586#M37213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark, I took what you provided and rewrote it a bit to work with my variable names and file names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select DX_5A, DX_5B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Into :DX_5Alist, :DX_5Blist&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Separated by ","&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; From medicaid.DXcodes_cardiology;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works and gives me an output that looks like a crosstab frequency for the 2 variables.&amp;nbsp; So as I'm trying to understand this, it looks like this is the 1st step of the process -- the values present in the variables assigned into a pair of macro variables.&amp;nbsp; But then how do I compare the values in the macro variables to the values in the medical records in DXcardiology._spec_cat?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 18:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198586#M37213</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2015-07-13T18:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198587#M37214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So let's assume that you want to assign the variable C_CODE from CARD_LIST to every record in CARD_CLAIMS.&lt;/P&gt;&lt;P&gt;(Let's also assume that you have cleaned up C_CODE so that is does not contain both &lt;SPAN style="font-size: 12pt; font-family: 'courier new', courier;"&gt;"7" and "'7'"&lt;/SPAN&gt; as two different codes for the same thing.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;proc sql ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp; create table want as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*,b.c_code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from card_claim a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join card_list b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on (a.dx is not null)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and ((a.dx = b.dx_5b) or&amp;nbsp; (a.dx = b.dx_5a))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 18:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198587#M37214</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-13T18:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198588#M37215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's not quite what I'm trying to get it to do, but I think it's close.&amp;nbsp; Let me try to explain it again, just so we're all on the same page... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The variables DX_5A and DX_5B in "card_list" contain a list of all cardiology-related diagnosis codes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what I want SAS to do is look at the first record in "card_claims", find the value that is stored in the DX variable for that record, and then determine is that value is present ANYWHERE in the DX_5A and DX_5B variables in "card_list".&amp;nbsp; If so, the record in "card_claims" should be retained, and if not, then it should be deleted.&amp;nbsp; And then I need to repeat that process for all records in "card_claims".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I think what you have above would work, but don't I want to use RIGHT JOIN?&amp;nbsp; I only want to retain records that have a DX value that matches any of the values stored in the DX_5A and DX_5B variables in "card_list".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 16:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198588#M37215</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2015-07-14T16:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198589#M37216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. So you have a special case of the general problem of putting the DX codes into categories.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 16:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198589#M37216</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-14T16:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198590#M37217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just realized there's a complication.&amp;nbsp; One of the things we want to know is what diagnosis codes cardiologists frequently use that AREN'T cardiology diagnoses.&amp;nbsp; Using the above approach, those non-cardiology DX codes would be lost.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 17:28:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198590#M37217</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2015-07-14T17:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a value with a list stored in another file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198591#M37218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you DO want the LEFT JOIN . &lt;/P&gt;&lt;P&gt;Sounds like CARD_CLAIM is the list of DX codes actually used and CARD_LIST is the list of "card" DX codes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 18:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-a-value-with-a-list-stored-in-another-file/m-p/198591#M37218</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-14T18:52:44Z</dc:date>
    </item>
  </channel>
</rss>

