<?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 I rearrange my columns to rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880332#M347841</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi, I want a transposed dataset. The problem for me now is that I want to merge two datasets, but one of them contains multiple observations under the same ID, like what shows in the first table. Since both type and length are the required variables I want to use in the merged new dataset and they are corresponded, I'm trying to find a way that is able to combine them together. For example, since I have three categories of Type in the first table, I want to make three new variables: 'Type 1', 'Type 2' and 'Type 3'; and under each type, I want to put in the corresponding 'Length' number&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jun 2023 02:13:22 GMT</pubDate>
    <dc:creator>LarissaW</dc:creator>
    <dc:date>2023-06-13T02:13:22Z</dc:date>
    <item>
      <title>How do I rearrange my columns to rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880322#M347837</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 291px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84924i6A763F5D683ADDFA/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;my data looks like this now&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.png" style="width: 385px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84925i20701EDCD869F5BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm wondering if is there a way that I could transfer the 'Length' variable into a corresponding table with x-axis "Type' and y-axis 'ID'?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 23:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880322#M347837</guid>
      <dc:creator>LarissaW</dc:creator>
      <dc:date>2023-06-12T23:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rearrange my columns to rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880325#M347838</link>
      <description>Hi:&lt;BR /&gt;  PROC REPORT could generate the table you show. I am confused over whether you want a report table, a graph image or an transposed dataset?&lt;BR /&gt;Cynthia</description>
      <pubDate>Tue, 13 Jun 2023 00:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880325#M347838</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2023-06-13T00:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rearrange my columns to rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880327#M347839</link>
      <description>&lt;P&gt;It is not clear which is your starting data and which is the one that you want.&lt;/P&gt;
&lt;P&gt;If you want to graph anything that first appearance of data is likely much nicer in the long run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc sgplot data=have;
   scatter x=type y=id / group=length;
run;&lt;/PRE&gt;
&lt;P&gt;For example will create a scatter plot with a different marker/color combination for each value of length. Many values of length can make the graph busy with multiple symbol/colors.&lt;/P&gt;
&lt;PRE&gt;Proc sgpanel data=have;
   panelby length;
   scatter x=type y=id;
run;&lt;/PRE&gt;
&lt;P&gt;The above will create a graph with separate panels for values of length (though lots of values may require some additional options to look nice).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 00:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880327#M347839</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-13T00:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rearrange my columns to rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880331#M347840</link>
      <description>&lt;P&gt;Hi, I want a transposed dataset. The problem for me now is that I want to merge two datasets, but one of them contains multiple observations under the same ID, like what shows in the first table. Since both type and length are the required variables I want to use in the merged new dataset and they are corresponded, I'm trying to find a way that is able to combine them together. For example, since I have three categories of Type in the first table, I want to make three new variables: 'Type 1', 'Type 2' and 'Type 3'; and under each type, I want to put in the corresponding 'Length' number&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 02:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880331#M347840</guid>
      <dc:creator>LarissaW</dc:creator>
      <dc:date>2023-06-13T02:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rearrange my columns to rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880332#M347841</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi, I want a transposed dataset. The problem for me now is that I want to merge two datasets, but one of them contains multiple observations under the same ID, like what shows in the first table. Since both type and length are the required variables I want to use in the merged new dataset and they are corresponded, I'm trying to find a way that is able to combine them together. For example, since I have three categories of Type in the first table, I want to make three new variables: 'Type 1', 'Type 2' and 'Type 3'; and under each type, I want to put in the corresponding 'Length' number&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 02:13:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880332#M347841</guid>
      <dc:creator>LarissaW</dc:creator>
      <dc:date>2023-06-13T02:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rearrange my columns to rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880343#M347842</link>
      <description>&lt;P&gt;You erroneously posted this in the Graphics community, do you got some misleading answers. I moved this to Programming.&lt;/P&gt;
&lt;P&gt;Use PROC TRANSPOSE:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose
  data=have
  out=want (rename=(_name_=type col1=length))
;
by id;
var type:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2023 04:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880343#M347842</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-13T04:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rearrange my columns to rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880349#M347846</link>
      <description>Thank you!</description>
      <pubDate>Tue, 13 Jun 2023 06:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880349#M347846</guid>
      <dc:creator>LarissaW</dc:creator>
      <dc:date>2023-06-13T06:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rearrange my columns to rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880389#M347860</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Simple PROC TRANSPOSE*/
data have;
input id type length;
cards;
1 1 3
1 2 1
1 3 2
2 1 2
2 3 3
3 1 1
;
proc transpose data=have out=temp(drop=_name_) prefix=Type;
by id ;
var length;
id type;
run;
proc stdize data=temp out=want reponly missing=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2023 12:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-rearrange-my-columns-to-rows/m-p/880389#M347860</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-13T12:03:27Z</dc:date>
    </item>
  </channel>
</rss>

