<?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: Merge 3 datasets in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870572#M38545</link>
    <description>&lt;P&gt;In SAS discussions MERGE is a "side by side" type of data combining where common named variables will behave quite differently than SQL similar operations. Also a data step merge can have very unexpected results when BY variables have repeated values in two or more data sets and will usually show a warning about such in the LOG. Was there such a warning in the LOG for the data step merge. So when discussing combining data in SAS do not use "merge" unless you mean that side-by-side row combination.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "union all" is a vertical or stack, which would be an Append procedure operation or SET in the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2023 14:58:44 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-04-19T14:58:44Z</dc:date>
    <item>
      <title>Merge 3 datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870552#M38535</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am trying to merge three datasets. I have tried two different ways and they both are giving me incorrect numbers (because each file has around 1 million records, so total should be around 3 millions). One of the way is removing duplicate reference_number and giving me 1.7 million records and other is giving me 4.3 million records. Can you please suggest the correct way to merge these datasets?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Merge multiple datasets with reference_number as common value*/
proc sql;
create table Equifax_files as
select * from work.elnz_lowell_11oct
union all
select * from work.elnz_lowell_10feb
union all
select * from work.elnz_lowell_12sep
order by reference_number;
quit;
/* Method 2 */
Data Equifax_files ;
merge work.elnz_lowell_12sep work.elnz_lowell_11oct work.elnz_lowell_10feb;
by reference_number;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2023 13:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870552#M38535</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-04-19T13:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Merge 3 datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870553#M38536</link>
      <description>Are you trying to "stack" (or concatenate) the data sets? If so, in Method 2, the "MERGE" statement can be replaced with a "SET" statement and you can remove the "BY" statement completely.&lt;BR /&gt;&lt;BR /&gt;Currently, in Method 2, you are going to perform a join in which observations with common values for "reference_number" will be combined (which is why you are seeing fewer than 3 million-ish observations in your result).</description>
      <pubDate>Wed, 19 Apr 2023 14:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870553#M38536</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2023-04-19T14:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Merge 3 datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870559#M38538</link>
      <description>&lt;P&gt;I would go with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181543"&gt;@svh&lt;/a&gt;&amp;nbsp;idea, i.e.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Equifax_files ;
set work.elnz_lowell_12sep work.elnz_lowell_11oct work.elnz_lowell_10feb;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Sone reading about this:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/n1tgk0uanvisvon1r26lc036k0w7.htm#n0mvuijqtjdsybn1h4t0q3sea7uh" target="_blank"&gt;https://documentation.sas.com/doc/en/lrcon/9.4/n1tgk0uanvisvon1r26lc036k0w7.htm#n0mvuijqtjdsybn1h4t0q3sea7uh&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 14:16:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870559#M38538</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-04-19T14:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Merge 3 datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870572#M38545</link>
      <description>&lt;P&gt;In SAS discussions MERGE is a "side by side" type of data combining where common named variables will behave quite differently than SQL similar operations. Also a data step merge can have very unexpected results when BY variables have repeated values in two or more data sets and will usually show a warning about such in the LOG. Was there such a warning in the LOG for the data step merge. So when discussing combining data in SAS do not use "merge" unless you mean that side-by-side row combination.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "union all" is a vertical or stack, which would be an Append procedure operation or SET in the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 14:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merge-3-datasets/m-p/870572#M38545</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-04-19T14:58:44Z</dc:date>
    </item>
  </channel>
</rss>

