<?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: VLOOKUP dataset with file in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/VLOOKUP-dataset-with-file/m-p/637157#M19073</link>
    <description>&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select a, b, c, d, e,&amp;nbsp;&lt;/P&gt;&lt;P&gt;case when a=x and b=z then 'TRUE'&lt;/P&gt;&lt;P&gt;else 'FALSE'&lt;/P&gt;&lt;P&gt;end as validity&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from file&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Apr 2020 03:59:39 GMT</pubDate>
    <dc:creator>fsuzhang</dc:creator>
    <dc:date>2020-04-03T03:59:39Z</dc:date>
    <item>
      <title>VLOOKUP dataset with file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/VLOOKUP-dataset-with-file/m-p/637154#M19072</link>
      <description>&lt;P&gt;I have been trying to solve this for awhile and I really need help with DF.&lt;/P&gt;&lt;P&gt;I have file with 5 columns, I need to validate this file against a whitelist file using an expression.&lt;/P&gt;&lt;P&gt;I cannot do a left or right join because it will create additional rows that are not in the original file.&lt;/P&gt;&lt;P&gt;Inner join will remove rows that I need. I also tried a seekbegin() to the whitelist file but I don't think I'm doing it right. Any help will be appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pre-expression:&lt;/P&gt;&lt;P&gt;string VALIDITY&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;file f&lt;BR /&gt;string curr_line&lt;BR /&gt;string COLUMNA&lt;BR /&gt;string COLUMNB&lt;BR /&gt;integer COLUMNC&lt;/P&gt;&lt;P&gt;f.open("\\whitelist.csv","r")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;begin&lt;BR /&gt;f.seekbegin(0)&lt;BR /&gt;curr_line= f.readline()&lt;BR /&gt;while (curr_line)&lt;BR /&gt;parse(COLUMNA,",",COLUMNB,",",COLUMNC)&lt;BR /&gt;begin&lt;BR /&gt;curr_line= f.readline()&lt;BR /&gt;while isnull(VALIDITY)&lt;BR /&gt;begin&lt;BR /&gt;&amp;lt;conditional logic&amp;gt;&lt;BR /&gt;then VALIDITY = 'VALID'&lt;BR /&gt;else VALIDITY = 'INVALID'&lt;BR /&gt;end&amp;nbsp;&lt;BR /&gt;end&lt;BR /&gt;end&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 13:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/VLOOKUP-dataset-with-file/m-p/637154#M19072</guid>
      <dc:creator>Vinz867</dc:creator>
      <dc:date>2020-04-03T13:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: VLOOKUP dataset with file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/VLOOKUP-dataset-with-file/m-p/637157#M19073</link>
      <description>&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select a, b, c, d, e,&amp;nbsp;&lt;/P&gt;&lt;P&gt;case when a=x and b=z then 'TRUE'&lt;/P&gt;&lt;P&gt;else 'FALSE'&lt;/P&gt;&lt;P&gt;end as validity&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from file&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 03:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/VLOOKUP-dataset-with-file/m-p/637157#M19073</guid>
      <dc:creator>fsuzhang</dc:creator>
      <dc:date>2020-04-03T03:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: VLOOKUP dataset with file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/VLOOKUP-dataset-with-file/m-p/637168#M19074</link>
      <description>&lt;P&gt;Use a hash object:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
if _n_ = 1
then do;
  declare hash wl (dataset:"whitelist (keep=x z)");
  wl.definekey("x","z");
  wl.definedone();
end;
validity = ifc(wl.find(key:a,key:b) = 0,"Yes","No");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested; for tested code, provide example data in datasteps with datalines.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 06:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/VLOOKUP-dataset-with-file/m-p/637168#M19074</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-03T06:59:37Z</dc:date>
    </item>
  </channel>
</rss>

