<?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 deal with two datasets in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-deal-with-two-datasets/m-p/501242#M15571</link>
    <description>&lt;P&gt;Your question is very clear, but sadly this is a VERY challenging type of requirement to implement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS has some very sophisticated text analytics tools, which cost a very sophisticated price. On the off chance that you have access to one of them, use it!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, I think you're going to need to do some pre-processing of your "Conclusion" field, to try to get it into a reasonable form for matching (for example, the "no sign of..." type construct is always going to be a huge problem). SAS has two text matching functions, COMPGED and COMPLEV. I'm attaching an example of how it could be used below; the only problem is that the results aren't correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully this will move you another step closer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Exams;
	length Conclusion $30;
	input ID Conclusion &amp;amp;;
	cards;
1 Signs of arrhytmia.
2 Hypoplastic syndrome of left heart
3 Normal exam.
4 No sign of ventricular septal defect. Arrythmia.
run;

data Descriptions;
	length Description $30;
	input Code Description &amp;amp;;
	cards;
0.0 Normal exam
1.1 Ventricular septal defect
2.2 Arrhytmia
3.3 Hypoplastic left heart syndrome
run;

proc sql noprint;
	create table Combined as
		select e.ID, e.Conclusion, d.Code, d.Description, complev(e.Conclusion, d.Description, 1000, "il") as MatchScore
			from Exams e cross join Descriptions d
				order by MatchScore;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Oct 2018 18:36:42 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2018-10-03T18:36:42Z</dc:date>
    <item>
      <title>How to deal with two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-deal-with-two-datasets/m-p/501233#M15570</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set that contains two variables : the subject ID and the conclusion of a medical exam.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;CONCLUSION&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Signs of arrhytmia.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Hypoplastic syndrome of left heart&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Normal exam.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;No sign of ventricular septal defect. Arrythmia.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to assign a code (from another data set) according to what is written in the conclusion variable.&lt;/P&gt;&lt;P&gt;The data set containing the codes looks like this :&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CODE&lt;/TD&gt;&lt;TD&gt;DESCRIPTION&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.0&lt;/TD&gt;&lt;TD&gt;Normal exam&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1.1&lt;/TD&gt;&lt;TD&gt;Ventricular septal defect&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.2&lt;/TD&gt;&lt;TD&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Arrhytmia&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;3.3&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hypoplastic left heart syndrome&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a way to match those two data sets and a function that would assign a code even if the expression is not the exact same. In addition to that, if it is written "no sign of", is there a way to not assign the code? Plus, if the word order is not the exact same, is it possible to assign the code anyway (see the hypoplastic left heart syndrome in my exemple).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I specify that it has to be as automatic as possible because my data set has about 20,000 observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an exemple of what I am looking for :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;CONCLUSION&lt;/TD&gt;&lt;TD&gt;CODE&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Signs of arrhytmia&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;2.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Hypoplastic syndrome of left heart&lt;/TD&gt;&lt;TD&gt;3.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Normal exam.&lt;/TD&gt;&lt;TD&gt;0.0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;No sign of ventricular septal defect. Arrythmia.&lt;/TD&gt;&lt;TD&gt;2.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it is not clear enough, please tell me. I will try to make it more clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 18:03:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-deal-with-two-datasets/m-p/501233#M15570</guid>
      <dc:creator>dera</dc:creator>
      <dc:date>2018-10-03T18:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to deal with two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-deal-with-two-datasets/m-p/501242#M15571</link>
      <description>&lt;P&gt;Your question is very clear, but sadly this is a VERY challenging type of requirement to implement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS has some very sophisticated text analytics tools, which cost a very sophisticated price. On the off chance that you have access to one of them, use it!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, I think you're going to need to do some pre-processing of your "Conclusion" field, to try to get it into a reasonable form for matching (for example, the "no sign of..." type construct is always going to be a huge problem). SAS has two text matching functions, COMPGED and COMPLEV. I'm attaching an example of how it could be used below; the only problem is that the results aren't correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully this will move you another step closer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Exams;
	length Conclusion $30;
	input ID Conclusion &amp;amp;;
	cards;
1 Signs of arrhytmia.
2 Hypoplastic syndrome of left heart
3 Normal exam.
4 No sign of ventricular septal defect. Arrythmia.
run;

data Descriptions;
	length Description $30;
	input Code Description &amp;amp;;
	cards;
0.0 Normal exam
1.1 Ventricular septal defect
2.2 Arrhytmia
3.3 Hypoplastic left heart syndrome
run;

proc sql noprint;
	create table Combined as
		select e.ID, e.Conclusion, d.Code, d.Description, complev(e.Conclusion, d.Description, 1000, "il") as MatchScore
			from Exams e cross join Descriptions d
				order by MatchScore;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Oct 2018 18:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-deal-with-two-datasets/m-p/501242#M15571</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-10-03T18:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to deal with two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-deal-with-two-datasets/m-p/501301#M15572</link>
      <description>20000 is actually not too bad. Although fully automating is likely impossible there are some methods to speed this up. First clean the data up as much as possible, capitalize or lower cas everything, remove punctuation, extraneous symbols. &lt;BR /&gt;Second, run a proc freq on the data and check your groupings. If you see a lot of things that can be grouped together you can do those first. Then assign them the correct code. You can separate the words for each observation against the codes and merge on those, scoring more words that’s match higher and if you find a NOT or NOT FOUND or INCONCLUSIVE you set it as no. For these, verify the matches using ocular test. It’s not perfect and with 20k observations you may get just as good results as if you did it manually. Building a process means you can reuse some parts. OpenRefine is a great tool for this if you want to give that a shot as well. It’s a tool designed for data cleaning via Google and they open sourced it.</description>
      <pubDate>Wed, 03 Oct 2018 23:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-deal-with-two-datasets/m-p/501301#M15572</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-03T23:12:41Z</dc:date>
    </item>
  </channel>
</rss>

