<?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: Merging Data Error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729551#M227049</link>
    <description>&lt;P&gt;Sorry, duplicate postings from malfunctioning browser (posting gave false negative, eventually generating "504 Error, request could not be satisfied").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;When you MERGE datasets, they are typically assumed to be sorted by the merge key(s).&amp;nbsp; This common usage of merge reads each dataset sequentially, which offers a lot of speed advantages.&amp;nbsp; This is why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;told you to sort the relevant files prior to the merge step.&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;True, merge can also work with unsorted data, but only if the merged datasets are indexed by the single merge key&amp;nbsp; (or has a compound index on the multiple merge keys).&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;Avoiding pre-sorting is often why many programmers use PROC SQL to join files, but this approach does not have access to some of the tools available in merge (like the first. and last. dummy variables, or lag functions.&lt;/STRIKE&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 27 Mar 2021 16:19:09 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2021-03-27T16:19:09Z</dc:date>
    <item>
      <title>Merging Data Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729523#M227029</link>
      <description>&lt;P&gt;I have been instructed to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create a new dataset called “Complete_Data” by merging the datasets “Audit_Data” and “Firm_Data” on the variables GVKEY and FISCAL_YEAR_ENDED.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;As always this is my code:&lt;BR /&gt;data reg.Complete_Data;&lt;BR /&gt;merge reg.Firm_data reg.Audit_data;&lt;BR /&gt;by gvkey fiscal_year_ended;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I'm getting an error that reads ERROR: BY variables are not properly sorted on reg.Audit_Data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What does this mean and how can I alleviate this problem?&lt;/P&gt;</description>
      <pubDate>Sat, 27 Mar 2021 01:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729523#M227029</guid>
      <dc:creator>krg1140</dc:creator>
      <dc:date>2021-03-27T01:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729524#M227030</link>
      <description>&lt;P&gt;The datasets you are merging on aren't sorted in the order you are trying to merge. Sort them first like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = reg.Firm_data ;
  by gvkey fiscal_year_ended;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Mar 2021 01:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729524#M227030</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-03-27T01:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729550#M227048</link>
      <description>&lt;P&gt;When you MERGE datasets, they are typically assumed to be sorted by the merge key(s).&amp;nbsp; This common usage of merge reads each dataset sequentially, which offers a lot of speed advantages.&amp;nbsp; This is why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;told you to sort the relevant files prior to the merge step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;True, merge can also work with unsorted data, but only if the merged datasets are indexed by the single merge key&amp;nbsp; (or has a compound index on the multiple merge keys).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Avoiding pre-sorting is often why many programmers use PROC SQL to join files, but this approach does not have access to some of the tools available in merge (like the first. and last. dummy variables, or lag functions).&lt;/P&gt;</description>
      <pubDate>Sat, 27 Mar 2021 13:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729550#M227048</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-27T13:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729551#M227049</link>
      <description>&lt;P&gt;Sorry, duplicate postings from malfunctioning browser (posting gave false negative, eventually generating "504 Error, request could not be satisfied").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;When you MERGE datasets, they are typically assumed to be sorted by the merge key(s).&amp;nbsp; This common usage of merge reads each dataset sequentially, which offers a lot of speed advantages.&amp;nbsp; This is why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;told you to sort the relevant files prior to the merge step.&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;True, merge can also work with unsorted data, but only if the merged datasets are indexed by the single merge key&amp;nbsp; (or has a compound index on the multiple merge keys).&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;Avoiding pre-sorting is often why many programmers use PROC SQL to join files, but this approach does not have access to some of the tools available in merge (like the first. and last. dummy variables, or lag functions.&lt;/STRIKE&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Mar 2021 16:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729551#M227049</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-27T16:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729552#M227050</link>
      <description>&lt;P&gt;Sorry, duplicate postings from malfunctioning browser user:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;When you MERGE datasets, they are typically assumed to be sorted by the merge key(s).&amp;nbsp; This common usage of merge reads each dataset sequentially, which offers a lot of speed advantages.&amp;nbsp; This is why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;told you to sort the relevant files prior to the merge step.&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;True, merge can also work with unsorted data, but only if the merged datasets are indexed by the single merge key&amp;nbsp; (or has a compound index on the multiple merge keys).&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;Avoiding pre-sorting is often why many programmers use PROC SQL to join files, but this approach does not have access to some of the tools available in merge (like the first. and last. dummy variables, or lag functions.&lt;/STRIKE&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Mar 2021 16:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Error/m-p/729552#M227050</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-27T16:16:25Z</dc:date>
    </item>
  </channel>
</rss>

