<?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 merge data sets with IDs of different formats? in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-data-sets-with-IDs-of-different-formats/m-p/198537#M4355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I figure out that my raw data sets had a typo that prevented effective merging. Thanks for your help, your code works fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Jun 2015 03:47:48 GMT</pubDate>
    <dc:creator>NonSleeper</dc:creator>
    <dc:date>2015-06-03T03:47:48Z</dc:date>
    <item>
      <title>How to merge data sets with IDs of different formats?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-data-sets-with-IDs-of-different-formats/m-p/198535#M4353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to merge two data sets using two ID variables whose characteristics look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Data set 1:&lt;/P&gt;&lt;P&gt;IDVar1: Type=Char; Length=42; Format=Blank (i.e., nothing's seen on the description cell of PROC contents output)&lt;/P&gt;&lt;P&gt;IDVar2: Type=Char; Length=21; Format=Blank&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Data set 2:&lt;/P&gt;&lt;P&gt;IDVar1: Type=Char; Length=19; Format=Blank; Informat = $19.&lt;/P&gt;&lt;P&gt;IDVar2; Type=Char; Length=21; Format=Blank; Informat = $21.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried several ways to create identical formats among these variables in order to merge these data sets yet none has worked; that is, a lot of observations in two data sets supposed to merge with each other based on the substantive values of ID variables turned out to be separate in merged data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, this is one failed attempt:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want1; length IDVar1 $50 IDVar2 $50; set have1; run;&lt;/P&gt;&lt;P&gt;data want2; length IDVar1 $50 IDVar2 $50; set have2; run;&lt;/P&gt;&lt;P&gt;data want3; length IDVar1 $50 IDVar2 $50; merge want1 want2; by IDVar1 IDVar2; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want1; format IDVar1 $50. IDVar2 $50.; set have1; run;&lt;/P&gt;&lt;P&gt;data want2; format IDVar1 $50. IDVar2 $50.; set have2; run;&lt;/P&gt;&lt;P&gt;data want3; format IDVar1 $50. IDVar2 $50.; merge want1 want2; by IDVar1 IDVar2; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And it also failed. I also try combining both of these as well as playing around with a few other maneuvers, such as removing informat in data set 2 but still unsuccessful. At first when these variables were at different lengths, there was a warning message on log file. But even after making them of the same format and length (so the warning message didn't show up), the result was still the same.&lt;/P&gt;&lt;P&gt;So can you give me a hint or solution over this task?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 02:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-data-sets-with-IDs-of-different-formats/m-p/198535#M4353</guid>
      <dc:creator>NonSleeper</dc:creator>
      <dc:date>2015-06-03T02:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge data sets with IDs of different formats?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-data-sets-with-IDs-of-different-formats/m-p/198536#M4354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'times new roman', times; font-size: 12pt;"&gt;Hi NonSleeper,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'times new roman', times; font-size: 12pt;"&gt;Not sure what the error is and it'll be good to post the log output?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'times new roman', times; font-size: 12pt;"&gt;In the mean time, perhaps you would like to try this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; alter table &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;have1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; modify &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar1 &lt;/SPAN&gt;char(50) format=$50. informat=$50.&lt;/P&gt;&lt;P&gt;&amp;nbsp; modify &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar2 &lt;/SPAN&gt;char(50) format=$50. informat=$50.;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;proc sql;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; alter table &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;have2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; modify &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar1 &lt;/SPAN&gt;char(50) format=$50. informat=$50.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; modify &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar2 &lt;/SPAN&gt;char(50) format=$50. informat=$50.;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;quit;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;proc sort data=have1; by &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar1 &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar2; run;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;proc sort data=have2; by &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar1 &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar2; run;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;data want; merge have1 have2; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;by &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar1 &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IDVar2; run;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 03:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-data-sets-with-IDs-of-different-formats/m-p/198536#M4354</guid>
      <dc:creator>Miracle</dc:creator>
      <dc:date>2015-06-03T03:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge data sets with IDs of different formats?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-data-sets-with-IDs-of-different-formats/m-p/198537#M4355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I figure out that my raw data sets had a typo that prevented effective merging. Thanks for your help, your code works fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 03:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-data-sets-with-IDs-of-different-formats/m-p/198537#M4355</guid>
      <dc:creator>NonSleeper</dc:creator>
      <dc:date>2015-06-03T03:47:48Z</dc:date>
    </item>
  </channel>
</rss>

