<?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 do I compare two datasets using string variables? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273699#M19002</link>
    <description>&lt;P&gt;If there are no matches how are you getting information from Table B to Table A?&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2016 19:47:15 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-05-27T19:47:15Z</dc:date>
    <item>
      <title>How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273648#M18992</link>
      <description>&lt;P&gt;Hi everyone! I'm a new user of EG and i'm fascinated with the capabilities of the tool. Rigth now i'm working on two datasets, the first one (A) is 250k+ rows and 25 columns, the second one (B) is around 25k rows and only 2&amp;nbsp;columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do sort of a VLOOKUP, getting info from B that matches A and put it in C (new table) but there's two things: i haven't found a way of&amp;nbsp;joining them the easy&amp;nbsp;way (using queries); the other one I tried doing it programming but i'm not an expert in this language.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what i've tried, in separate, but doesn't seem to be working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;
	CREATE TABLE C AS
	SELECT DISTINCT t1.UNIDAD,
		t2.unidad as unidad1,
		t2.marca
	FROM QUERY_FOR_PAGOSPROVEEDORES t1 
		LEFT JOIN MARCAS_Y_UNIDADES1 t2 ON (t1.UNIDAD LIKE t2.UNIDAD);
QUIT;

proc sql;
	create table test as
	select t1.UNIDAD, t2.UNIDAD
	from work.query_for_pagosproveedores t1, work.marcas_y_unidades1 t2
	where upcase(marcas_y_unidades1.UNIDAD) contains upcase(query_for_pagosproveedores.UNIDAD);
quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, a couple of images from both A and B datasets:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3368i98B258B66B949014/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="t1.jpg" title="t1.jpg" width="531" height="364" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3369iC9EB0772355A9F76/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="t2.jpg" title="t2.jpg" width="542" height="506" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i do this? Thanks in advance, any help will be much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: data in A repeats. I'm using SAS EG 5.1 (64-bit).&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 16:57:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273648#M18992</guid>
      <dc:creator>GuillermoPH</dc:creator>
      <dc:date>2016-05-27T16:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273653#M18993</link>
      <description>&lt;P&gt;From your example data I do not think you ever have much luck trying to compare those UNIDAD fields directly as they look way too different.&lt;/P&gt;
&lt;P&gt;My approach would be to pull add a variable to your table A with the Marca information. Then add model information such as "TSURU" or "TACOMA" or "H100" to both data sets. Then you wold have a chance on matching on those two variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In one form of looking at data your "UNIDAD" field should&amp;nbsp;probably&amp;nbsp;be&amp;nbsp;at least 3 variables (Make Model (not your current Modelo variable which a model year which is another variable that would ideally be in both data sets)&amp;nbsp;and Trim level) with some serious attention paid to the data entry. Since your table A looks like it is likely to be user entered then you should spend some time "cleaning" which means getting things consistent such as only one of:&amp;nbsp;Mercedes, Mercedes-Benz, MBenz, Mercedes Benz (no -).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 17:09:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273653#M18993</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-27T17:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273658#M18996</link>
      <description>&lt;P&gt;Thanks ballardw, maybe i should've been more precise: the data you see in A is part of what i have in B. In some cases yes, it is user entered however the major part is "trimmed" but not to the same length (it varies, not sure why).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eg. from A you would get &lt;STRONG&gt;"&amp;nbsp;&lt;U&gt;TR KENWORTH T 600 B 42&lt;/U&gt;" "&lt;/STRONG&gt; in the first row; in B it would look like &lt;STRONG&gt;"&amp;nbsp;&lt;U&gt;TR KENWORTH T 600 B 42&lt;/U&gt;" STD., 02 OCUP. "&lt;/STRONG&gt;,&amp;nbsp;If I do&amp;nbsp;a manual search using a query and filtering UNIDAD &lt;EM&gt;contains&amp;nbsp;&lt;/EM&gt;&lt;SPAN&gt;TR KENWORTH T 600 B 42", it works perfectly. Of course I can't do this process 250k+ times manually&amp;nbsp;&lt;img id="mantongue" class="emoticon emoticon-mantongue" src="https://communities.sas.com/i/smilies/16x16_man-tongue.png" alt="Man Tongue" title="Man Tongue" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;not sure if i explained myself...&amp;nbsp;&lt;img id="manfrustrated" class="emoticon emoticon-manfrustrated" src="https://communities.sas.com/i/smilies/16x16_man-frustrated.png" alt="Man Frustrated" title="Man Frustrated" /&gt; sure there's&amp;nbsp;a way i can do this automatically&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 17:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273658#M18996</guid>
      <dc:creator>GuillermoPH</dc:creator>
      <dc:date>2016-05-27T17:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273686#M18997</link>
      <description>&lt;P&gt;Post sample data please. Not as images, but as text.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 18:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273686#M18997</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-27T18:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273687#M18998</link>
      <description>&lt;P&gt;Sure, sample data as text:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;UNIDAD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;TR KENWORTH T 600 B 42"&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;NISSAN TSURU GSII PLUS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS NISSAN CHASIS CABINA LARGO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PY TOYOTA TACOMA TRD DOBLE CAB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;GMOTORS ACADIA V/P 4X4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;MBENZ E-300 V6 SEDAN ADVANTGAR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;MBENZ GLK 300 CGI OFF ROAD SPO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;MBENZ SPRINTER 415 WAGON C/A T&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HYUNDAI / HYUNDAI GRAND I10 GL&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;VW "EL NUEVO" JETTA A4 EUROPA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CHEVROLET EXPRESS VAN SERVPUB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;RENAULT DUSTER EXPRESSION 4X2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 CHASIS CABINA KT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;FORD EXPLORER XLT 3.5L 290HP V&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DODGE NITRO SLT 4X2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;UNIDAD&lt;/TD&gt;&lt;TD&gt;MARCA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 KTP XL CH 2P V8 6.2L 2WD AC 3.5TON AUT., 03 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 KTP XL PLUS CH 2P V8 6.2L AC 3.5TON STD., 03 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 KTP XL PLUS CH 2P V8 6.2L EFI AC R17 AUT., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 KTP XLT CH 2P V8 6.2L 2WD 3.5TON STD., 03 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP 6.7L V8 TDI AUT., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP XL PLUS TDI 6.4L AUT., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP XL PLUS TDI 6.4L STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP XL PLUS V10 6.8L AUT., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP XL PLUS V10 6.8L STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA S.D XL A/AC DIESEL STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA SUPER DUTY XL A/AC STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA SUPER DUTY XL BA STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA SUPER DUTY XL DIESEL STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA SUPER DUTY XL GAS LP STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA SUPER DUTY XL STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA XL V10 A/AC BA STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA XL V10 C/A AC STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA XL V8 C/A AC DIESEL STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA XL V8 DIESEL AUT., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 18:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273687#M18998</guid>
      <dc:creator>GuillermoPH</dc:creator>
      <dc:date>2016-05-27T18:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273688#M18999</link>
      <description>&lt;P&gt;If I understand correctly, based on your sample data there would be no matches? Perhaps some sample data where there would be matches and what the output should be...&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 18:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273688#M18999</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-27T18:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273693#M19000</link>
      <description>&lt;P&gt;Yes, there are no matches. The result output should look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;UNIDAD (FROM TABLE A)&lt;/TD&gt;&lt;TD&gt;UNIDAD (FROM TABLE B)&lt;/TD&gt;&lt;TD&gt;MARCA (FROM TABLE B)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 CHASIS CABINA KT&lt;/TD&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP XL PLUS TDI 6.4L AUT., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 CHASIS CABINA KT&lt;/TD&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP XL PLUS TDI 6.4L STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 CHASIS CABINA KT&lt;/TD&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP XL PLUS V10 6.8L AUT., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS FORD F-350 CHASIS CABINA KT&lt;/TD&gt;&lt;TD&gt;CS FORD F-450 CHASIS CABINA KTP XL PLUS V10 6.8L STD., 02 OCUP.&lt;/TD&gt;&lt;TD&gt;FORD&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume if I use DISTINCT there would be only 1 row, however it'd look something like that.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 18:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273693#M19000</guid>
      <dc:creator>GuillermoPH</dc:creator>
      <dc:date>2016-05-27T18:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273699#M19002</link>
      <description>&lt;P&gt;If there are no matches how are you getting information from Table B to Table A?&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 19:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273699#M19002</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-27T19:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273702#M19003</link>
      <description>&lt;P&gt;I get no matches because certainly I'm doing something wrong in my coding, that's why i'm asking for help. My previous reply has what the output should look like.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 19:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273702#M19003</guid>
      <dc:creator>GuillermoPH</dc:creator>
      <dc:date>2016-05-27T19:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273704#M19004</link>
      <description>&lt;P&gt;I get why your code isn't working. What I'm asking for is a worked example. Based on your sample data, table A and Table B your output doesn't align with what your asking for, there are no matches from sample table A to sample table B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I'm guessing it doesn't and you didn't provide data that would actually work for testing...if we don't have data that will match in a test ita kinda hard to test. I would basically have to develop my own test data for your situation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 19:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273704#M19004</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-27T19:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare two datasets using string variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273732#M19006</link>
      <description>&lt;P&gt;You can use functions in your join condition, so using the substr to create strings the same length that will then match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example with mock data from SASHELP.CLASS mocked up. It should give you the idea.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll want to play around with the join type to get the one you want (left/right/inner/outer)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class1;
length name $40.;
set sashelp.class;
name=catx(" ", name, "Black");
run;

data class2;
set sashelp.class;
ID = _n_;
if ID in (12, 13, 15, 19) then delete;
if name='Alfred' then name='Jonathon';
if name='Carol' then name='Tanisha';
run;



proc sql;
create table want as
select a.name as name1,
       b.name as name2,
       b.ID
from class1 as a
full outer join class2 as b
on b.name=substr(a.name, 1, length(b.name))
order by b.ID;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 May 2016 22:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-compare-two-datasets-using-string-variables/m-p/273732#M19006</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-27T22:02:36Z</dc:date>
    </item>
  </channel>
</rss>

