<?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 chnage structure of table by row and columns points in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/631195#M186986</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have a summary table that contain 3 categorical variables and one continuous variable(called "Reduce").&lt;/P&gt;
&lt;P&gt;There are 18 rows (and 18 numbers of "Reduce" var).&lt;/P&gt;
&lt;P&gt;The target is to display same table in a structure of 3 rows&amp;nbsp; and 6 columns.&lt;/P&gt;
&lt;P&gt;I have added 2 variables called:Row Column&amp;nbsp; that tell uf where to locate each number.&lt;/P&gt;
&lt;P&gt;What is the way to create the required table please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Summarytbl;
infile datalines dsd;
input Cat2_Y $ 	Cat1_Y $ 	Cat1_X $ 	Reduce 	Row  	Column ;
cards;
No,SecondMax,No,15000,1,1
No,SecondMax,10,14500,1,2
No,SecondMax,20,12000,1,3
No,Max,No,11500,1,4
Yes,SecondMax,No,11000,2,1
No,Max,10,10500,1,5
Yes,SecondMax,10,10000,2,2
No,Max,20,9500,1,6
Yes,SecondMax,20,9000,2,3
Yes,Max,No,8500,2,4
Yes,Max,10,8000,2,5
Yes,Max,20,5000,2,6
Yes,SecondMax,No,4500,3,1
Yes,SecondMax,10,4000,3,2
Yes,Max,No,3500,3,4
Yes,SecondMax,20,3000,3,3
Yes,Max,10,2500,3,5
Yes,Max,20,2000,3,6
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Mar 2020 10:54:53 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2020-03-11T10:54:53Z</dc:date>
    <item>
      <title>chnage structure of table by row and columns points</title>
      <link>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/631195#M186986</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have a summary table that contain 3 categorical variables and one continuous variable(called "Reduce").&lt;/P&gt;
&lt;P&gt;There are 18 rows (and 18 numbers of "Reduce" var).&lt;/P&gt;
&lt;P&gt;The target is to display same table in a structure of 3 rows&amp;nbsp; and 6 columns.&lt;/P&gt;
&lt;P&gt;I have added 2 variables called:Row Column&amp;nbsp; that tell uf where to locate each number.&lt;/P&gt;
&lt;P&gt;What is the way to create the required table please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Summarytbl;
infile datalines dsd;
input Cat2_Y $ 	Cat1_Y $ 	Cat1_X $ 	Reduce 	Row  	Column ;
cards;
No,SecondMax,No,15000,1,1
No,SecondMax,10,14500,1,2
No,SecondMax,20,12000,1,3
No,Max,No,11500,1,4
Yes,SecondMax,No,11000,2,1
No,Max,10,10500,1,5
Yes,SecondMax,10,10000,2,2
No,Max,20,9500,1,6
Yes,SecondMax,20,9000,2,3
Yes,Max,No,8500,2,4
Yes,Max,10,8000,2,5
Yes,Max,20,5000,2,6
Yes,SecondMax,No,4500,3,1
Yes,SecondMax,10,4000,3,2
Yes,Max,No,3500,3,4
Yes,SecondMax,20,3000,3,3
Yes,Max,10,2500,3,5
Yes,Max,20,2000,3,6
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 10:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/631195#M186986</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-03-11T10:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: chnage structure of table by row and columns points</title>
      <link>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/631201#M186990</link>
      <description>&lt;P&gt;What text should we have the row names be? 1 2 or 3&lt;/P&gt;
&lt;P&gt;What text should we have the column names be? 1 2 3 4 5 or 6&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 11:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/631201#M186990</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-11T11:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: chnage structure of table by row and columns points</title>
      <link>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/631227#M187000</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; This is what you can get from PROC REPORT using your ROW, COLUMN and other variables:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc_report_across.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36755iEA19BDFC8EEFD72F/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc_report_across.png" alt="proc_report_across.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I'm not sure from your description that this is what you intended with Cat2_Y, Cat1_Y, Cat1_X and Reduce all under the columns. And this output generates a report, not a data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 13:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/631227#M187000</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-03-11T13:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: chnage structure of table by row and columns points</title>
      <link>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/632293#M187447</link>
      <description>&lt;P&gt;Reshaping your data into a 3 x 6 table will lose the categorical context maintained by cat1_x cat1_y cat2_y.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Transpose will create an output data set with the new shape&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
  by row column;
run;

proc transpose data=have out=want;
  by row;
  id column;
  var reduce;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tabulate can report the data in a new shape&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=have;
  class row column;
  var reduce;

  table 
    row='', 
    column=''*reduce=''*sum=''
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Mar 2020 23:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/chnage-structure-of-table-by-row-and-columns-points/m-p/632293#M187447</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-03-15T23:56:05Z</dc:date>
    </item>
  </channel>
</rss>

