<?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 combine data through Concatenate and Interleaving in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316314#M69093</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data concat;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; either&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&amp;nbsp; dh bc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set bc dh;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data interleave;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set dh bc;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;by flavor;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set bc dh;&amp;nbsp;&amp;nbsp;&amp;nbsp; by flavor;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take a look at the difference between the&amp;nbsp; two concat results, and at the difference between the two interleave results&amp;nbsp; Each difference is&amp;nbsp;attributable to the order of the incoming dataset names in the respective SET statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the "data interleave" step assumes the each&amp;nbsp; inoming dataset (DH and BC) are already sorted by flavor.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Dec 2016 17:23:21 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2016-12-02T17:23:21Z</dc:date>
    <item>
      <title>How to combine data through Concatenate and Interleaving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316285#M69089</link>
      <description>&lt;P&gt;Duncan Hines&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Flavor &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Height in cm.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Devil's food &amp;nbsp; 39&lt;/P&gt;&lt;P&gt;Devil's food &amp;nbsp; 36.5&lt;/P&gt;&lt;P&gt;White &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30.5&lt;/P&gt;&lt;P&gt;White &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;34.5&lt;/P&gt;&lt;P&gt;Yellow &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;37.0&lt;/P&gt;&lt;P&gt;Yellow &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;35.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Betty Crocker&lt;/P&gt;&lt;P&gt;------------------------------------------------&lt;/P&gt;&lt;P&gt;Flavor &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Height in cm.&lt;/P&gt;&lt;P&gt;------------------------------------------------&lt;/P&gt;&lt;P&gt;Devil's food &amp;nbsp; &amp;nbsp;35.5&lt;/P&gt;&lt;P&gt;Devil's food &amp;nbsp; 36.0&lt;/P&gt;&lt;P&gt;White &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 35.5&lt;/P&gt;&lt;P&gt;White &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 37.5&lt;/P&gt;&lt;P&gt;Yellow &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;32.5&lt;/P&gt;&lt;P&gt;Yellow &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 32.5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So let's say I have these two data sets above one for Duncan Hines and one for Betty crocker, how do I&amp;nbsp;&lt;/P&gt;&lt;P&gt;a. Combine these two data sets by&amp;nbsp;Concatenating&lt;/P&gt;&lt;P&gt;b.&amp;nbsp;Combine these two data sets interleaving by flavor&lt;/P&gt;&lt;P&gt;*the variables should be read as how they are spaced and the spacing not be replaced by underscore.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 16:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316285#M69089</guid>
      <dc:creator>nrb</dc:creator>
      <dc:date>2016-12-02T16:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data through Concatenate and Interleaving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316287#M69090</link>
      <description>&lt;P&gt;Whilst it is good you have provided test data, it is also important to post these as datasteps (i.e. with datalines) so that we can see the structure also. &amp;nbsp;I am going to assume therefore in the below that they are exactly the same structure - i.e. type/length:&lt;/P&gt;
&lt;P&gt;a)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set duncan betty;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;b)&lt;/P&gt;
&lt;P&gt;as a, then add:&lt;/P&gt;
&lt;P&gt;proc sort data=want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; by flavour;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 16:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316287#M69090</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-02T16:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data through Concatenate and Interleaving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316314#M69093</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data concat;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; either&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&amp;nbsp; dh bc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set bc dh;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data interleave;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set dh bc;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;by flavor;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set bc dh;&amp;nbsp;&amp;nbsp;&amp;nbsp; by flavor;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take a look at the difference between the&amp;nbsp; two concat results, and at the difference between the two interleave results&amp;nbsp; Each difference is&amp;nbsp;attributable to the order of the incoming dataset names in the respective SET statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the "data interleave" step assumes the each&amp;nbsp; inoming dataset (DH and BC) are already sorted by flavor.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 17:23:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316314#M69093</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-02T17:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data through Concatenate and Interleaving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316339#M69108</link>
      <description>&lt;P&gt;Another approach to the interleave is MERGE by flavor which would look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge duncan betty;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by flavor;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However you need to 1) have each of those sets sorted using the BY variable mentioned and&lt;/P&gt;
&lt;P&gt;2) Other variables with the same name from Betty will replace the value from Duncan, so you need to rename them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BUT any combination of data sets you should specify what the result looks like be starting to combine them. MANY approaches will lose the information of which set the values come from if not careful.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 18:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-through-Concatenate-and-Interleaving/m-p/316339#M69108</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-02T18:23:38Z</dc:date>
    </item>
  </channel>
</rss>

