<?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: Transposing a Row into a Column in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387141#M65841</link>
    <description>&lt;P&gt;PROC TRANSPOSE&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2017 18:34:42 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-08-10T18:34:42Z</dc:date>
    <item>
      <title>Transposing a Row into a Column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387138#M65840</link>
      <description>&lt;P&gt;Hey Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick (hopefully simple) question&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below data as table name "GC_SGRP_BREAKOUT"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HSHLD_NO &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SGRP_DSCR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SPEND_TY&lt;/P&gt;&lt;P&gt;00010005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SPECIALITY GIFT CARDS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&lt;/P&gt;&lt;P&gt;00010005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HOME GIFT CARDS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50&lt;/P&gt;&lt;P&gt;00010005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FASHION GIFT CARDS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;50&lt;/P&gt;&lt;P&gt;00010005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RESTAURANTS GIFT CARDS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;105&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I want it to read as this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HSHLD_NO &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;SPECIALITY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HOME &amp;nbsp; &amp;nbsp; &amp;nbsp; FASHION &amp;nbsp; &amp;nbsp; &amp;nbsp;RESTAURANTS&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;00010005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;25 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;50 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;105&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do i make this happen in SAS?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Nick&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:35:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387138#M65840</guid>
      <dc:creator>ciccotelli412</dc:creator>
      <dc:date>2017-08-10T18:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Transposing a Row into a Column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387141#M65841</link>
      <description>&lt;P&gt;PROC TRANSPOSE&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387141#M65841</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-10T18:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Transposing a Row into a Column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387143#M65842</link>
      <description>&lt;P&gt;Can you be a little more specific? Like what the full code would be?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387143#M65842</guid>
      <dc:creator>ciccotelli412</dc:creator>
      <dc:date>2017-08-10T18:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Transposing a Row into a Column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387147#M65843</link>
      <description>&lt;P&gt;If you don't know how to find examples for a procedure in the documentation, that's a good thing to learn. Navigate to the procedure name and then it has a section/tab titled Examples. There's usually the most basic case, which is yours, and then more advanced examples as well. &amp;nbsp;Here's a few links to get you started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Documentation&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#p1n9l1b2dg00w9n1h3tovj0rwlos.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#p1n9l1b2dg00w9n1h3tovj0rwlos.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#n01rzqgzs8vq1bn10h1wtx914kyf.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#n01rzqgzs8vq1bn10h1wtx914kyf.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UCLA walk through&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LexJansen.com search results&lt;/P&gt;
&lt;P&gt;&lt;A href="http://lexjansen.com/search/searchresults.php?q=proc%20transpose" target="_blank"&gt;http://lexjansen.com/search/searchresults.php?q=proc%20transpose&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387147#M65843</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-10T18:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Transposing a Row into a Column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387158#M65844</link>
      <description>&lt;P&gt;For a beginner, PROC TRANSPOSE is not easy.&amp;nbsp; In this case, it's harder because you have to prepare your data before PROC TRANSPOSE can be applied.&amp;nbsp; Two simple preparatory steps ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, create a variable holding the names to be used after transposing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data partway_there;&lt;/P&gt;
&lt;P&gt;set gc_sgrp_breakout;&lt;/P&gt;
&lt;P&gt;varname = scan(sgrp_dscr, 1);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can take a look at VARNAME, and expect to use it in an ID statement within PROC TRANSPOSE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, sort&amp;nbsp; your data (if it's not already sorted):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=partway_there;&lt;/P&gt;
&lt;P&gt;by hshld_no;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This permits you to use a BY statement within PROC TRANSPOSE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, head into the PROC TRANSPOSE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc transpose data=partway_there out=want;&lt;/P&gt;
&lt;P&gt;by hshld_no;&lt;/P&gt;
&lt;P&gt;id varname;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will have to add to that final TRANSPOSE to get it to function the way&amp;nbsp;you would like.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 19:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transposing-a-Row-into-a-Column/m-p/387158#M65844</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-10T19:07:32Z</dc:date>
    </item>
  </channel>
</rss>

