<?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 sets of data with a field with a character data type in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791102#M253345</link>
    <description>&lt;P&gt;Post example data in usable and unambiguous form. Use a data step with datalines so we can be sure about data types, raw content, and formats.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;DO NOT SKIP THIS.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jan 2022 09:45:37 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-01-20T09:45:37Z</dc:date>
    <item>
      <title>Join two sets of data with a field with a character data type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791016#M253296</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I am going to join two datasets through a common field. But the variable in one dataset has this format: 1000 and it has this format in second dataset: 1000*01.&lt;/P&gt;
&lt;P&gt;How can take *01 from the second dataset to make variables look same.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;BlueBlue&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 20:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791016#M253296</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-01-19T20:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Join two sets of data with a field with a character data type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791024#M253300</link>
      <description>&lt;P&gt;You could convert the values in one of the dataset into the style that the other has.&lt;/P&gt;
&lt;P&gt;Say your two datasets are named STAR and NO_STAR and the variable is question is named ID.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new_star;
  set star;
  old_id=id;
  id = scan(id,1,'*');
run;
data want;
  merge no_star new_star;
  by id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or with SQL syntax you could to the conversion and join in one step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
create table want as 
select * 
from star(rename=(id=old_id)) a
full join no_star b
on scan(a.old_id,1,'*') = b.id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that if you have repeats of ID values in both datasets then the results will be different using SQL to join the records than what happens with a data step merge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 20:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791024#M253300</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-19T20:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Join two sets of data with a field with a character data type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791027#M253302</link>
      <description>&lt;P&gt;Please remember when talking about SAS data sets the Format has a very specific meaning as in a property assigned to variables that control how the values display. Appearance can have very little in common with actual values.&lt;/P&gt;
&lt;P&gt;For example I have multiple variables that have values like 1 and 2 but the &lt;STRONG&gt;appearance&lt;/STRONG&gt; because of the assigned format is 'Male' or 'Female'.&lt;/P&gt;
&lt;P&gt;So, are you talking about Format or Value when you say " variable in one dataset has this format: 1000 and it has this format in second dataset: 1000*01."?&amp;nbsp; Note that when you mention a value of 1000 you really need to state if the value is numeric 1000 or character "1000" as this has a major impact on how you compare values reliably.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably should include more than one example value as we don't know if 1) every single value ends in "*01", is more than 7 characters long and 3) whether the conversion needs to become numeric or not. Also, the presence of leading spaces can make a significant difference.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 21:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791027#M253302</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-19T21:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Join two sets of data with a field with a character data type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791102#M253345</link>
      <description>&lt;P&gt;Post example data in usable and unambiguous form. Use a data step with datalines so we can be sure about data types, raw content, and formats.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;DO NOT SKIP THIS.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 09:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-two-sets-of-data-with-a-field-with-a-character-data-type/m-p/791102#M253345</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-20T09:45:37Z</dc:date>
    </item>
  </channel>
</rss>

