<?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 Merging wide and long datasets in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403689#M66898</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge one wide and one long data set. Both datasets have information on the same participants which is identified by the variable ID.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I sort the datasets by ID, can I merge them from their original data formats? Or do I have to make both datasets into the same format (both long or both wide files) in order to merge them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I greatly appreciate your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Joanna&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2017 20:31:41 GMT</pubDate>
    <dc:creator>joannahh</dc:creator>
    <dc:date>2017-10-12T20:31:41Z</dc:date>
    <item>
      <title>Merging wide and long datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403689#M66898</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge one wide and one long data set. Both datasets have information on the same participants which is identified by the variable ID.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I sort the datasets by ID, can I merge them from their original data formats? Or do I have to make both datasets into the same format (both long or both wide files) in order to merge them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I greatly appreciate your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Joanna&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403689#M66898</guid>
      <dc:creator>joannahh</dc:creator>
      <dc:date>2017-10-12T20:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Merging wide and long datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403692#M66899</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/92846"&gt;@joannahh&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once I sort the datasets by ID, can I merge them from their original data formats? Or do I have to make both datasets into the same format (both long or both wide files) in order to merge them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can merge them without changing them to the same structure, as long as the output will be what you want. It's really dependent on what you want as output.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403692#M66899</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-12T20:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Merging wide and long datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403696#M66900</link>
      <description>&lt;P&gt;Thank you so much for your fast response!&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the following syntax is what I used and my output is in a long file (which is what I wanted):&amp;nbsp;&lt;/P&gt;&lt;P&gt;"data merged; merge wide long(in = a) ; by ID; if a; run;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if I am providing sufficient information for a response but I was wondering if getting a long-file output is what you would expect from the above syntax.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403696#M66900</guid>
      <dc:creator>joannahh</dc:creator>
      <dc:date>2017-10-12T20:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Merging wide and long datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403709#M66904</link>
      <description>&lt;P&gt;By "long", I presume you mean a dataset with possible repeats of the by variable ID.&amp;nbsp; And by "wide" do you mean one observation per ID?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so then your program will&amp;nbsp;be a "LONG left join WIDE on long.id=wide.id" in proc sql syntax.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 21:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-wide-and-long-datasets/m-p/403709#M66904</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-10-12T21:26:42Z</dc:date>
    </item>
  </channel>
</rss>

