<?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: Going from long file to wide file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805611#M317353</link>
    <description>&lt;P&gt;There are many ways to convert data from a long form to a wide form in SAS.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/sgf/2016/01/15/new-year-refresher-on-reshaping-data-2/" target="_self"&gt;SAS provides "SAS Notes"&lt;/A&gt; that show how to convert from long to wide&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Transpose-your-analysis-data-with-the-MAKELONG-and-MAKEWIDE/ta-p/791732" target="_self"&gt;You can look at the %MAKEWISE macro&lt;/A&gt;, which is provided by&amp;nbsp;Gerhard Svolba (@&lt;SPAN&gt;gsvolba)&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;You can post your data in the form of a DATA step and you'll get multiple other ways&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Sat, 02 Apr 2022 10:50:36 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2022-04-02T10:50:36Z</dc:date>
    <item>
      <title>Going from long file to wide file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805569#M317340</link>
      <description>Hi all,

I have a long file with ID, time 1, and time 2. There can be multiple of the same ID in the file:

Not sure whether it matters, but time1 and time2 are NOT sequential. Or rather, they could be but they are not measuring the same thing over time or anything like that so they could be identical, time1 &amp;gt; time2, or time2&amp;gt;time1.

ID   time1   time2
1        1         3
1        2         2
1        3         1 
2        1        4
2         3        2
3         2       2

What I want is a file that is wide, ie, gives each set of time1 and time2 for a specific ID:
ID    time1_1  time2_1   time1_2         time2_2      time1_3         time2_3
1           1            3             2                   2                 3                     1
2           1            4             3                   2
3           2           2

As you can see, IDs can but don't necessarily have multiple records. The number of time pairings has no upper limit. 

Any help is much appreciated!</description>
      <pubDate>Fri, 01 Apr 2022 20:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805569#M317340</guid>
      <dc:creator>Walternate</dc:creator>
      <dc:date>2022-04-01T20:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Going from long file to wide file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805571#M317341</link>
      <description>&lt;P&gt;Please show us (a portion of) the data, as SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;instructions&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, could you explain why this wide format is necessary, what can you do better with a wide format compared to a long format.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 20:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805571#M317341</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-01T20:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Going from long file to wide file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805611#M317353</link>
      <description>&lt;P&gt;There are many ways to convert data from a long form to a wide form in SAS.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/sgf/2016/01/15/new-year-refresher-on-reshaping-data-2/" target="_self"&gt;SAS provides "SAS Notes"&lt;/A&gt; that show how to convert from long to wide&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Transpose-your-analysis-data-with-the-MAKELONG-and-MAKEWIDE/ta-p/791732" target="_self"&gt;You can look at the %MAKEWISE macro&lt;/A&gt;, which is provided by&amp;nbsp;Gerhard Svolba (@&lt;SPAN&gt;gsvolba)&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;You can post your data in the form of a DATA step and you'll get multiple other ways&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sat, 02 Apr 2022 10:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805611#M317353</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-04-02T10:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Going from long file to wide file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805628#M317360</link>
      <description>&lt;P&gt;Please help us help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Please make clear the arrangement of the data you have to start with, in the form of a working data step, as per the&amp;nbsp;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/&amp;nbsp;" target="_self"&gt;instructions&lt;/A&gt;&amp;nbsp;link provided by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Do the same with the desired output layout.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 14:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Going-from-long-file-to-wide-file/m-p/805628#M317360</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-04-02T14:58:16Z</dc:date>
    </item>
  </channel>
</rss>

