<?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 Transpose Values by Unique ID in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transpose-Values-by-Unique-ID/m-p/784787#M250435</link>
    <description>&lt;P&gt;I have the following data. A table of events that can contain any number of codes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
    input id$ code$ @@;
    datalines;
    aa x1 aa x1 aa x2
    bb x1 bb y1 bb y1 bb z2 bb z4
    cc x1 cc x2 cc y1 cc x1 cc x1 cc q1
    dd z2 dd z2 dd z2 dd q1
    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to transpose the data so the codes associated with each event is stored in the same row.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 408px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66480i47F48824CD9C9A33/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Dec 2021 23:27:29 GMT</pubDate>
    <dc:creator>cobba</dc:creator>
    <dc:date>2021-12-07T23:27:29Z</dc:date>
    <item>
      <title>Transpose Values by Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-Values-by-Unique-ID/m-p/784787#M250435</link>
      <description>&lt;P&gt;I have the following data. A table of events that can contain any number of codes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
    input id$ code$ @@;
    datalines;
    aa x1 aa x1 aa x2
    bb x1 bb y1 bb y1 bb z2 bb z4
    cc x1 cc x2 cc y1 cc x1 cc x1 cc q1
    dd z2 dd z2 dd z2 dd q1
    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to transpose the data so the codes associated with each event is stored in the same row.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 408px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66480i47F48824CD9C9A33/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 23:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-Values-by-Unique-ID/m-p/784787#M250435</guid>
      <dc:creator>cobba</dc:creator>
      <dc:date>2021-12-07T23:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose Values by Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-Values-by-Unique-ID/m-p/784789#M250437</link>
      <description>&lt;P&gt;This seems to work for your example:&lt;/P&gt;
&lt;PRE&gt;proc transpose data=have out=want(drop=name)
  prefix=code;
  by id;
  var code;
run;
 &lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/408985"&gt;@cobba&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the following data. A table of events that can contain any number of codes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data have;
    input id$ code$ @@;
    datalines;
    aa x1 aa x1 aa x2
    bb x1 bb y1 bb y1 bb z2 bb z4
    cc x1 cc x2 cc y1 cc x1 cc x1 cc q1
    dd z2 dd z2 dd z2 dd q1
    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to transpose the data so the codes associated with each event is stored in the same row.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 408px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66480i47F48824CD9C9A33/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 09:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-Values-by-Unique-ID/m-p/784789#M250437</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-12-08T09:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose Values by Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-Values-by-Unique-ID/m-p/784793#M250441</link>
      <description>&lt;P&gt;&amp;nbsp;I got it to work by moving the prefix up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc transpose data=have out=want (drop=name) prefix=code;
  by id;
  var code;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 23:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-Values-by-Unique-ID/m-p/784793#M250441</guid>
      <dc:creator>cobba</dc:creator>
      <dc:date>2021-12-07T23:59:34Z</dc:date>
    </item>
  </channel>
</rss>

