<?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 DI Studio Transpose Long to Wide in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435659#M13473</link>
    <description>&lt;P&gt;Hey Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm struggling a bit with the Transpose transformation.&lt;/P&gt;
&lt;P&gt;I have data that looks like so:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 432pt;" width="576" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt; width: 54pt;" width="72" height="20"&gt;inst_code&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;deg_code&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;year_postgrad&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;cip_4dig&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;grad_cohort&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p25&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p50&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p75&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;5&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;10&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;5&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;10&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;5&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;10&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;2&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;4&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;2&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;4&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;6&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need it to end up like this:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 540pt;" width="720" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt; width: 54pt;" width="72" height="20"&gt;inst_code&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;deg_code&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;cip_4dig&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;grad_cohort&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p25_1&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p50_1&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p75_1&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p25_5&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p50_5&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p75_5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD align="right"&gt;15&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;30&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;45&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;4&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;8&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, I'm grouping by inst_code, deg_code, cip_4dig, and grad_cohort, and using that 'year_postgrad' column to help transpose the 'pxx' numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can do this in a series of various other transformations, but I was hoping to just do this in one for simplicity and assumed the Transpose transformation would be best.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any suggestions or advice!&lt;/P&gt;
&lt;P&gt;-Jeff&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2018 14:54:43 GMT</pubDate>
    <dc:creator>jwhite</dc:creator>
    <dc:date>2018-02-09T14:54:43Z</dc:date>
    <item>
      <title>DI Studio Transpose Long to Wide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435659#M13473</link>
      <description>&lt;P&gt;Hey Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm struggling a bit with the Transpose transformation.&lt;/P&gt;
&lt;P&gt;I have data that looks like so:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 432pt;" width="576" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt; width: 54pt;" width="72" height="20"&gt;inst_code&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;deg_code&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;year_postgrad&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;cip_4dig&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;grad_cohort&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p25&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p50&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p75&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;5&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;10&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;5&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;10&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;5&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;10&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;2&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;4&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;2&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;4&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;6&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need it to end up like this:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 540pt;" width="720" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt; width: 54pt;" width="72" height="20"&gt;inst_code&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;deg_code&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;cip_4dig&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;grad_cohort&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p25_1&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p50_1&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p75_1&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p25_5&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p50_5&lt;/TD&gt;
&lt;TD style="width: 54pt;" width="72"&gt;p75_5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20" align="right"&gt;3656&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD align="right"&gt;2011&lt;/TD&gt;
&lt;TD align="right"&gt;15&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;30&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;45&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;4&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;8&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, I'm grouping by inst_code, deg_code, cip_4dig, and grad_cohort, and using that 'year_postgrad' column to help transpose the 'pxx' numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can do this in a series of various other transformations, but I was hoping to just do this in one for simplicity and assumed the Transpose transformation would be best.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any suggestions or advice!&lt;/P&gt;
&lt;P&gt;-Jeff&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 14:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435659#M13473</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2018-02-09T14:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio Transpose Long to Wide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435665#M13474</link>
      <description>&lt;P&gt;You can reduce it to two steps if you first download and run the macro you can find at:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/A-better-way-to-FLIP-i-e-transpose-make-wide-a-dataset/ta-p/433620/jump-to/first-unread-message" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/A-better-way-to-FLIP-i-e-transpose-make-wide-a-dataset/ta-p/433620/jump-to/first-unread-message&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using that macro, the following would accomplish the task:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc summary data=have nway;
  class inst_code deg_code cip_4dig grad_cohort year_postgrad;
  var p25 p50 p75;
  output out=need (drop=_:) sum=;
run;

%transpose(data=need, out=want, by=inst_code deg_code cip_4dig grad_cohort,
 id=year_postgrad, delimiter=_, var=p25	p50	p75)
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 15:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435665#M13474</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-02-09T15:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio Transpose Long to Wide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435813#M13477</link>
      <description>&lt;P&gt;Ok, so I've saved that macro.&lt;/P&gt;
&lt;P&gt;Would I use a 'User Written' node in DI Studio and not have any mappings, so the macro can generate the new (transposed) columns? OR would I need to create and assign the transposed columns in some way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, it looks like that code snipped requires three datasets (HAVE, NEED, and WANT). I currently have two. An IN and an OUT, or a SORTED and TRANSPOSED.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, I _think_ I'm on the way. I have wide columns now, but they values aren't summed based on groupings. Either I need to fill something in the 'sum=' option or maybe the three vs two datasets is an issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 19:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435813#M13477</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2018-02-09T19:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio Transpose Long to Wide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435828#M13478</link>
      <description>&lt;P&gt;Nevermind. I understand it all now.&lt;/P&gt;
&lt;P&gt;I needed that third table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers for the solution!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Jeff&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 19:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Transpose-Long-to-Wide/m-p/435828#M13478</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2018-02-09T19:53:45Z</dc:date>
    </item>
  </channel>
</rss>

