<?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: match two data sets with company names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524840#M142741</link>
    <description>&lt;P&gt;if everytime it is last word is one different then you can something like this&amp;nbsp;may work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
     create table temp03 as
	 select distinct a.*, b.permno, b.comnam, b.ticker as lookupticker, b.date
	 from temp02 as a 
	      left join temp01a as b
		  on upcase(scan(a.ticker,-1))=upcase(scan(b.ticker,-1))
		;  
quit; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 05 Jan 2019 21:08:48 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2019-01-05T21:08:48Z</dc:date>
    <item>
      <title>match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524834#M142737</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying&amp;nbsp; to merge two data sets by ticker symbols, but ticker symbols are not unique to every company, they can be reused by other companies, so I also need to merge two data sets by company names, The problem is names for same company in different data sets may be different in formats (such as up or lower case, inc. or corp, with "-" or " " in two words), how could I solve this problem? Please have a look of below codes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Songchan&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
     create table temp03 as
	 select distinct a.*, b.permno, b.comnam, b.ticker, b.date
	 from temp02 as a 
	      left join temp01a as b
		  on a.ticker=b.ticker;
quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 19:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524834#M142737</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-05T19:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524836#M142738</link>
      <description>&lt;P&gt;Can you provide some sample data for us to work with?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 20:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524836#M142738</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-05T20:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524837#M142739</link>
      <description>Hi, thanking for replying me. Please see attached documents</description>
      <pubDate>Sat, 05 Jan 2019 20:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524837#M142739</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-05T20:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524839#M142740</link>
      <description>&lt;P&gt;.xlsx files are not too good for sample data. However, there are a few ways to do this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could use the &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p1r4l9jwgatggtn1ko81fyjys4s7.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;COMPGED&lt;/A&gt;&amp;nbsp;or &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0l41pdemybegln1oetsh4cctdap.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;COMPLEV &lt;/A&gt;Functions. These are functions that compare strings and return some numeric constant&amp;nbsp;of the 'distance' between the two strings. The smaller the returned constant, the more the two strings look alike.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 21:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524839#M142740</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-05T21:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524840#M142741</link>
      <description>&lt;P&gt;if everytime it is last word is one different then you can something like this&amp;nbsp;may work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
     create table temp03 as
	 select distinct a.*, b.permno, b.comnam, b.ticker as lookupticker, b.date
	 from temp02 as a 
	      left join temp01a as b
		  on upcase(scan(a.ticker,-1))=upcase(scan(b.ticker,-1))
		;  
quit; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 21:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524840#M142741</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2019-01-05T21:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524841#M142742</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;What kind of sample data you wanna see? Because it's very hard for me to find which ticker has several companies to corresponded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 21:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524841#M142742</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-05T21:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524842#M142743</link>
      <description>&lt;P&gt;Thank you for your reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need two conditions now, one is with the same ticker, another is with similar company names (because i have to make sure they stand for the same company), the company names vary in many ways ( up or lower case, "blank between two words" or use "-")&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 21:17:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524842#M142743</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-05T21:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524843#M142744</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt;s code can be edited to look something like this. Does the logic that he describes work for you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
     create table temp03 as
	 select distinct a.*, b.permno, b.comnam, b.ticker as lookupticker, b.date
	 from temp02 as a 
	      left join temp01a as b
         on a.ticker=b.ticker
		   and upcase(scan(a.name,-1))=upcase(scan(b.name,-1))
		;  
quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 21:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524843#M142744</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-05T21:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524847#M142746</link>
      <description>&lt;P&gt;It works to some extents, but still not a good match. I think maybe there is no better way.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 21:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524847#M142746</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-05T21:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524849#M142747</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp; explains a sample will be helpful, otherwise it would be difficult. It made a template for you. Just try to make different ways you can see data will be helpful. And also mention how your output should be from your input datasets&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp02;
input ticker $  1-7  anotherval;
datalines;
AB INC 100
AC INC 200
;

data temp01a;
input ticker $ 1-7  anotherval1 9-11;
datalines;
AB INC  500
AC INC  200
AB      200
AD CORP 700
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 21:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524849#M142747</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2019-01-05T21:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524851#M142748</link>
      <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; temp02&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; ticker &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;  &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-7&lt;/SPAN&gt;  anotherval&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;datalines&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;ABC INC   ABC
AC INC    AC&lt;BR /&gt;A D INC   AD&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; temp01a&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; ticker &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-7&lt;/SPAN&gt;  anotherval1 &lt;SPAN class="token number"&gt;9&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-11&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;datalines&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;abc inc   ABC
AC  corp  AC
A-D corp  AD&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;the first column is company name, the second is ticker symbol. The result i desire is:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;ABC INC   ABC   abc inc
AC INC    AC    AC corp&lt;BR /&gt;A D INC   AD    A-D corp&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token punctuation"&gt;Another company names are various in someways, but they are the same companies and having the same ticker symbols&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 21:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524851#M142748</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-05T21:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524852#M142749</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/230936"&gt;@Songchan&lt;/a&gt;&amp;nbsp; I'm afraid none of the suggestions will work for this scenario&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;&amp;nbsp;i&lt;STRONG&gt;nc. or corp&lt;/STRONG&gt;,&amp;nbsp; This is really messy&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;with "-" or " " in two words) - This can be handled&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can you list all the possible messy stuff or is that all?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this all, no biggie, but i seriously doubt if that's the case&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 22:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524852#M142749</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-05T22:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524854#M142750</link>
      <description>&lt;P&gt;Isn’t there a data set somewhere that has ticker symbols and the dates they belong to a particular company? That would likely be a better way. Also, you’re going to miss name changes, same ticker but company rebrands under a different name. That’s more likely to occur IME than finding companies reusing the same symbol over time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would do a distance calc like suggested and take the nearest match.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For sample data, please try this, i know it’s not perfect but it’s a lot easier for people to work with. You should try to include as many variations of the issue as you can.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/230936"&gt;@Songchan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying&amp;nbsp; to merge two data sets by ticker symbols, but ticker symbols are not unique to every company, they can be reused by other companies, so I also need to merge two data sets by company names, The problem is names for same company in different data sets may be different in formats (such as up or lower case, inc. or corp, with "-" or " " in two words), how could I solve this problem? Please have a look of below codes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Songchan&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
     create table temp03 as
	 select distinct a.*, b.permno, b.comnam, b.ticker, b.date
	 from temp02 as a 
	      left join temp01a as b
		  on a.ticker=b.ticker;
quit; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 22:21:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524854#M142750</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-05T22:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524856#M142751</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Following things might help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. you should have lookup table for this as suggested by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; or you need to make a lookup table(with help of business users) and include new variations whenever you have new variations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. In absence of lookup table you need to have a program( small ETL code) which address this problem(business people might be able to help on this)&amp;nbsp; to tackle issues.&amp;nbsp; your code should also should&amp;nbsp; updates on regular basis as per business users&lt;/P&gt;
&lt;P&gt;Otherwise It is almost impossible to fix this kind of issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Most importantly you need&amp;nbsp; to sit with your business users and if possible define the rules along with them to handle the data.&amp;nbsp; It would be easier if you can get some help from business users on this. Mostly senior members/business analysts in your Team will have good idea on this kind of things.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 23:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524856#M142751</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2019-01-05T23:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524857#M142752</link>
      <description>&lt;P&gt;Hi, thank you for your reply. Yes, that's all.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 23:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524857#M142752</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-05T23:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524858#M142753</link>
      <description>&lt;P&gt;I am not going to suggest sas code to you, because I don't propose to convert your excel sheets into a sas data step for use in this forum.&amp;nbsp; However, if you do so, I'd be glad to give it a go.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see the first spreadsheet is CRSP data (id variable PERMNO) and it includes a single DATE variable.&amp;nbsp; And the other data has a NAME and TICKER, together with a STARTDATE and ENDDATE.&amp;nbsp; In the other data set, is the specified ticker in use by that company for the entire date range from STARTDATE to ENDDATE? If so then match on ticker conditional on the CRSP date falling between the startdate and enddate of the other data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if TICKER in the other data set only represents the status on ENDDATE,&amp;nbsp;then&amp;nbsp;note that you can go back to the CRSP data and make a ticker date range.&amp;nbsp; CRSP publishes another data set, NAMES, which includes events such as ticker change.&amp;nbsp; This would allow you to determine the full crsp date range for a ticker (say TICKERSTART and TICKEREND) that includes the date you already have in your CRSP data.&amp;nbsp; Then you could match on ticker, condition on the ENDDATE from the other dataset falling between TICKERSTART and TICKEREND.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you would have all the easy matches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit,&amp;nbsp;due to&amp;nbsp;unnoticed cut and paste result:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;which allows you to build a date range for a ticker belonging to a particular PERMNO.&amp;nbsp; Then you could do the same as above, but match on ticker, conditional on the ENDDATE of the other data set falling between the start and end of a ticker in CRSP.&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;&amp;nbsp;&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;&amp;nbsp;&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;that CRSP publishes other datasets, including a "names" dataset which will allow you to construct the actual time span a given ticker is assigned to a given PERMNO.&amp;nbsp; So you could enhance your CRSP data to include a ticker_start_date and ticker_end_date.&amp;nbsp;&amp;nbsp; Then match on ticker, without having to struggle with trying to standardize company names.&lt;/STRIKE&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 18:37:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524858#M142753</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-01-06T18:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524859#M142754</link>
      <description>&lt;P&gt;Here is what I tried, using complev. Seems to work pretty well. You might have to experiment with the best distance limit (10 in this example)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname t01 excel "&amp;amp;sasforum.\datasets\temp01a.xlsx";
libname t02 excel "&amp;amp;sasforum.\datasets\temp02.xlsx";

proc sql;
create table t01 as select * from t01.temp01a;
create table t02 as select * from t02.temp02;
quit;

proc sql;
create table names as
select ticker, upcase(comnam) as name from t01 
union
select ticker, upcase(name) as name from t02
order by ticker;
quit; 

data nameEqv;
array n{10} $60;
array e{10} $60;

do i = 1 by 1 until(last.ticker);
    set names; by ticker;
    n{i} = name;
    e{i} = name;
    do j = 1 to i-1;
        if complev(n{j}, n{i}, 10) &amp;lt; 10 then do;
            e{i} = e{j};
            leave;
            end;
        end;
    eqvName = e{i};
    output;
    end;

keep ticker name eqvName;
run;

proc sql;
create table t03 as
select 
    A.*,
    upcase(B.name) as otherName,
    B.issuerDescription,
    B.startDate,
    B.endDate
from 
    (select T01.*, n01.eqvName 
        from 
            T01 inner join 
            nameEqv as n01 
                on T01.ticker=n01.ticker and upcase(T01.comnam)=n01.name) as A inner join
    (select T02.*, n02.eqvName 
        from 
            T02 inner join 
            nameEqv as n02 
                on T02.ticker=n02.ticker and upcase(T02.name)=n02.name) as B
        on A.ticker=B.ticker and A.eqvName=B.eqvName;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 23:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524859#M142754</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-05T23:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524860#M142755</link>
      <description>&lt;P&gt;Thank you for your reply. I never used macro before, could you explain what do the first two rows mean (i.e. what "&amp;amp;sasforum.\datasets "stands for) ?&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 00:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524860#M142755</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-06T00:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524865#M142757</link>
      <description>&lt;P&gt;The two libname statements and the first proc SQL step bring the data from your Excel files into two datasets : t01 and t02. The real work starts on the second proc SQL step where a list of all distinct ticker-name combinations from both datasets is assembled.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 05:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524865#M142757</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-06T05:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: match two data sets with company names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524897#M142767</link>
      <description>&lt;P&gt;Thank you PG! That works! there are about 1,600s out of 2,889 observations matched. For the unmatched ones, do i have to match them manually or there is a better way?&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 15:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/match-two-data-sets-with-company-names/m-p/524897#M142767</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-06T15:41:44Z</dc:date>
    </item>
  </channel>
</rss>

