<?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 do we combine 2 datasets of different structures in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271681#M54048</link>
    <description>&lt;P&gt;Really, Unix can concatenate two SAS proprietary datasets, merging the headers and such like. &amp;nbsp;Thats amazing, I didn't think Unix even knew how SAS datasets were compiled? &amp;nbsp;Or do you mean you exported the data to text files and then concatenated? &amp;nbsp;If so why not just use one of the solutions above and skip that whole step.&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2016 11:49:57 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-05-19T11:49:57Z</dc:date>
    <item>
      <title>How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271208#M53960</link>
      <description>&lt;P&gt;I have 2 datasets..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Dataset 1:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; REC_NO &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Org Name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Country &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Date&lt;/P&gt;&lt;P&gt;1111 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Pizza Hut &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; India &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18052016&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Dataset 2:&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sl_No &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Email &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; First Name &amp;nbsp; &amp;nbsp; &amp;nbsp;Last Name &amp;nbsp; &amp;nbsp; &amp;nbsp; Outlet&lt;/P&gt;&lt;P&gt;2222 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Gary &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Gary@abc.com &amp;nbsp; &amp;nbsp; &amp;nbsp;Gary &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Linekar &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Gary's Pizza &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output Dataset Expected:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1111 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Pizza Hut &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; India &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18052016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2222 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Gary &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Gary@abc.com &amp;nbsp; &amp;nbsp; &amp;nbsp;Gary &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Linekar &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Gary's Pizza&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is there any way to concatinate 2 SAS datasets of different structure ???&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried normal data set statement but that is not the result expected.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 08:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271208#M53960</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2016-05-18T08:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271218#M53963</link>
      <description>&lt;P&gt;What you want to achieve runs contrary to the concept of datasets, where a column has the same attributes (type, size, name, display format) throughout all observations/records.&lt;/P&gt;
&lt;P&gt;In your case, you don't even have the same number of columns in the first place.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 08:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271218#M53963</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-05-18T08:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271234#M53968</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser﻿&lt;/a&gt;, what you want to do makes no sense. &amp;nbsp;The only thing I can thin of is that this is for a report? &amp;nbsp;If so then you can do something like:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  ID,
          REC_NO,
          ORG_NAME as COL1 length=200,
          COUNTRY as COL2 length=200,
          DATE as COL3 length=200,
          "" as COL4 length=200,
          "" as COL5 length=200
  from    HAVE1 
  union all
  select  ID,
          SI_NO as REC_NO,
          USER as COL1,
          EMAIL as COL2,
          FIRST_NAME as COL3,
          LAST_NAME as COL4,
          OUTLET as COL5
  from    HAVE2;
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 May 2016 09:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271234#M53968</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-18T09:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271244#M53973</link>
      <description>&lt;P&gt;Do you want to stack the data or add fields from one to another to create a single row with more variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given your sample the second seems more useful and would be obtained via a proc SQL join or data step merge.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 09:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271244#M53973</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-18T09:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271246#M53975</link>
      <description>&lt;P&gt;Ok so I have 2 SAS dataset &amp;amp; i have to generate a report out of these two dataset(combined) where dataset 1 as my 1st record followed by dataset 2.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 09:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271246#M53975</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2016-05-18T09:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271249#M53976</link>
      <description>&lt;P&gt;Do you have multiple records per dataset that need to be reported.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please take the time to detail your question. We're guessing at solutions and what to ask you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 09:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271249#M53976</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-18T09:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271254#M53978</link>
      <description>&lt;P&gt;You can do it ... sort of ... with this program:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set dataset1 dataset2 (rename=(user=OrgName FirstName=Country LastName=Date));&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are several issues you might encounter, however. &amp;nbsp;LASTNAME and DATE would both have to be character. &amp;nbsp;If that's not the case now, &amp;nbsp;you would have to change DATASET1 ahead of time to make it the case. &amp;nbsp;And variables might have different lengths, requiring a LENGTH statement to avoid truncation. &amp;nbsp;For example, if ORGNAME has a shorter length than USER, you would need to add this statement before the SET statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length OrgName $ 30;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just select the longest length needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As others have stated, this is a questionable idea. &amp;nbsp;You might be better off changing your reporting technique instead of trying to combine the data sets. &amp;nbsp;For example, you could use customzied reporting:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;set dataset1 (in=in1) dataset2 (in=in2);&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;file print;&lt;/P&gt;
&lt;P&gt;if in1 then put ...&lt;/P&gt;
&lt;P&gt;else if in2 then put ...&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DATA step is actually a bit more complex than this, and you would need to look for examples of "cutomized reporting". &amp;nbsp;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 09:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271254#M53978</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-18T09:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271256#M53980</link>
      <description>&lt;P&gt;Dataset 1 would be my header record.(only 1 record with fixed columns) Dataset 2 would be my data record.( n records with fixed columns).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 09:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271256#M53980</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2016-05-18T09:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271678#M54047</link>
      <description>&lt;P&gt;Hi all, Thanks for your valuable inputs.. I know this was kind of a crazy question. But i had to generate a report which would result like this!..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How i did it is by exporting both the SAS datasets &amp;amp; then used Unix&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cat dataset1 &amp;gt; dataset 2.. which did the trick for me!!!&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 11:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271678#M54047</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2016-05-19T11:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271681#M54048</link>
      <description>&lt;P&gt;Really, Unix can concatenate two SAS proprietary datasets, merging the headers and such like. &amp;nbsp;Thats amazing, I didn't think Unix even knew how SAS datasets were compiled? &amp;nbsp;Or do you mean you exported the data to text files and then concatenated? &amp;nbsp;If so why not just use one of the solutions above and skip that whole step.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 11:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271681#M54048</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-19T11:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do we combine 2 datasets of different structures</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271717#M54052</link>
      <description>&lt;P&gt;Yeah exported into flat files &amp;amp; concatinated !!!!&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 14:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-we-combine-2-datasets-of-different-structures/m-p/271717#M54052</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2016-05-19T14:06:21Z</dc:date>
    </item>
  </channel>
</rss>

