<?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: Join two datasets in SAS by a variable, which one is substring from another variable. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751431#M236550</link>
    <description>&lt;P&gt;Function findw() ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
select a.*,b.registered as b_registered
 from lefttable as a left join righttable as b
  on findw( a.plan_des  ,strip(b.plan_des));
quit;&lt;/PRE&gt;</description>
    <pubDate>Thu, 01 Jul 2021 12:09:19 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-07-01T12:09:19Z</dc:date>
    <item>
      <title>Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751120#M236404</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I want to Left join two datasets by a variable, which that variable is part of the other variable from left table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data LeftTable;
input plan_des: $15 registered;
datalines;
plan blue  12
Florida commerce plan 14
Florida plan ABC
;
Run

data right Table;
input plan_des: $15 registered;
datalines;
plan  15
commerce 14
 ABC
;
Run
&lt;/PRE&gt;
&lt;P&gt;The right dataset has only some part of the string from the left dataset. If we want to join them by plan_des, how can we do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Blue Blue&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 04:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751120#M236404</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-06-30T04:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751126#M236407</link>
      <description>&lt;P&gt;You may want to use the search function to get some solutions on how to join by partial match. You could use proc sql and index or find to in the where statement.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 05:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751126#M236407</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-06-30T05:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751128#M236408</link>
      <description>&lt;P&gt;SQL is your best bet here. One way:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;from LEFT left join RIGHT on LEFT.PLAN_DES like cats('%', RIGHT.PLAN_DES, '%')&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Another way:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;from LEFT left join RIGHT on index(LEFT.PLAN_DES,strip(RIGHT.PLAN_DES))&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 05:41:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751128#M236408</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-06-30T05:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751198#M236441</link>
      <description>&lt;PRE&gt;data LeftTable;
input plan_des &amp;amp; $35. registered;
datalines;
plan blue     12
Florida commerce plan    14
Florida plan ABC     .
;
Run;

data rightTable;
input plan_des: $15. registered;
datalines;
plan    15
commerce  14
BC  .
;
Run;

proc sql;
select a.*,b.registered as b_registered
 from lefttable as a left join righttable as b
  on a.plan_des contains strip(b.plan_des);
quit;
&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Jun 2021 12:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751198#M236441</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-06-30T12:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751292#M236483</link>
      <description>Will you use index function in another function?&lt;BR /&gt;If yes, what function? Is it substring?&lt;BR /&gt;Regards,&lt;BR /&gt;Blue blue</description>
      <pubDate>Wed, 30 Jun 2021 15:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751292#M236483</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-06-30T15:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751293#M236484</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;How do you know which characters are stripped off?&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Blue Blue&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 15:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751293#M236484</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-06-30T15:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751357#M236513</link>
      <description>Hello,&lt;BR /&gt;Thanks for the response:&lt;BR /&gt;This is what I have:&lt;BR /&gt;from table b Left join a on upcase(a.diagcode) = upcase(b.diagcode) &lt;BR /&gt;                                      And upcase(a.subdiagcod)=upcase(b.subdiagcode)&lt;BR /&gt;                                      And  upcase(a.plan) like cats('%',upcase(plan),'%');&lt;BR /&gt;line 266:                        quit;&lt;BR /&gt;&lt;BR /&gt;log shows errors line 266 in the program. Error 73-322: Expecting an = affected code: !symput('order_id'&lt;BR /&gt;shows errors line 266 in the program: Error 180-322: statement is not valid or it is used out of proper order.&lt;BR /&gt;Error 202-322: for same line&lt;BR /&gt;Error 22-322&lt;BR /&gt;Error 201-322&lt;BR /&gt;&lt;BR /&gt;If any tips is all much appreciated.&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue</description>
      <pubDate>Wed, 30 Jun 2021 19:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751357#M236513</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-06-30T19:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751359#M236515</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp; - Posting incomplete code plus error messages that don't relate to the code isn't helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post your complete SAS log including code, notes and errors and use the Insert Code icon (&amp;lt;/&amp;gt;) to ensure the formatting isn't mucked up.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 20:02:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751359#M236515</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-06-30T20:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751431#M236550</link>
      <description>&lt;P&gt;Function findw() ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
select a.*,b.registered as b_registered
 from lefttable as a left join righttable as b
  on findw( a.plan_des  ,strip(b.plan_des));
quit;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Jul 2021 12:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751431#M236550</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-01T12:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751480#M236565</link>
      <description>&lt;P&gt;Your posted code seems to be for different datasets than your original post.&lt;/P&gt;
&lt;P&gt;Use FIND() or FINDW() function because the support the trim and ignore case options.&amp;nbsp; The difference is whether you want to match when the smaller string is part of a larger word or only when it matches a full word in the larger string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;...
from table b 
  left join a 
  on upcase(a.diagcode) = upcase(b.diagcode)
  and upcase(a.subdiagcod)=upcase(b.subdiagcode)
  and findw(a.plan,b.plan,,'it')
...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Jul 2021 15:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/751480#M236565</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-01T15:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/752622#M237117</link>
      <description>Hello SASKiwi,&lt;BR /&gt;I don't know if I responded to you before. Sometime, log belongs to the&lt;BR /&gt;code that is for my work, I can't paste it to forum here.&lt;BR /&gt;Regards,&lt;BR /&gt;blue blue&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jul 2021 17:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/752622#M237117</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-07T17:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/752685#M237132</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp; - Is that because it is confidential? If so just make up a similar example using made-up data or one of SAS's sample tables in the SASHELP library.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 20:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/752685#M237132</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-07-07T20:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Join two datasets in SAS by a variable, which one is substring from another variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/752698#M237137</link>
      <description>Hello SASKiwi,&lt;BR /&gt;Yes, that is confidential. If they realize that I am posting their log, it&lt;BR /&gt;has legal consequences.&lt;BR /&gt;Sometimes it is not doable to create same thing with SAShelp and my SAs at&lt;BR /&gt;work doesn't have SASHELP.&lt;BR /&gt;&lt;BR /&gt;It is very hard to get responses from this forum, that is why we can't see&lt;BR /&gt;many professionals in SAS in the market, majority have SAS base&lt;BR /&gt;certificate only.  I have tried other forums, there are people that want&lt;BR /&gt;truly help.&lt;BR /&gt;&lt;BR /&gt;There is one mememer in the community that whenever I ask questions, he&lt;BR /&gt;sends a maxim.&lt;BR /&gt;&lt;BR /&gt;Thanks for all you do.&lt;BR /&gt;blueblue&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jul 2021 20:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-datasets-in-SAS-by-a-variable-which-one-is-substring/m-p/752698#M237137</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-07T20:24:36Z</dc:date>
    </item>
  </channel>
</rss>

