<?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 convert table with rows representing fields into columns in SAS EG? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-table-with-rows-representing-fields-into/m-p/821944#M324520</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Field  $ Value $;
cards;
ID       1
ColA   123
ColB   ABC
ColC   D1E
ID       2
ColA   456
ColB   DEF
ColC   G6H
;;;;
run;

data addID;
set have;
retain row;
if field='ID' then row=Value;
run;

proc transpose data=addID out=want ;
by row;
id field;
var value;
run;

proc print data=want;run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Jul 2022 22:35:42 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-07-06T22:35:42Z</dc:date>
    <item>
      <title>How do I convert table with rows representing fields into columns in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-table-with-rows-representing-fields-into/m-p/821938#M324518</link>
      <description>&lt;P&gt;Hi I have a dataset in list format which is an output from powershell that I've cleaned into two columns called Field and Value and it looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Field&amp;nbsp; &amp;nbsp;Value&lt;/P&gt;
&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;ColA&amp;nbsp; &amp;nbsp;123&lt;/P&gt;
&lt;P&gt;ColB&amp;nbsp; &amp;nbsp;ABC&lt;/P&gt;
&lt;P&gt;ColC&amp;nbsp; &amp;nbsp;D1E&lt;/P&gt;
&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;ColA&amp;nbsp; &amp;nbsp;456&lt;/P&gt;
&lt;P&gt;ColB&amp;nbsp; &amp;nbsp;DEF&lt;/P&gt;
&lt;P&gt;ColC&amp;nbsp; &amp;nbsp;G6H&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I convert this data into something like:&lt;/P&gt;
&lt;P&gt;ID&amp;nbsp; ColA&amp;nbsp; &amp;nbsp;ColB&amp;nbsp; &amp;nbsp;ColC&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; 123&amp;nbsp; &amp;nbsp; ABC&amp;nbsp; &amp;nbsp; D1E&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; 456&amp;nbsp; &amp;nbsp; DEF&amp;nbsp; &amp;nbsp; G6H&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried proc transpose, but it will just transpose all the columns as separate ones.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 21:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-table-with-rows-representing-fields-into/m-p/821938#M324518</guid>
      <dc:creator>SASAlex101</dc:creator>
      <dc:date>2022-07-06T21:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert table with rows representing fields into columns in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-table-with-rows-representing-fields-into/m-p/821944#M324520</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Field  $ Value $;
cards;
ID       1
ColA   123
ColB   ABC
ColC   D1E
ID       2
ColA   456
ColB   DEF
ColC   G6H
;;;;
run;

data addID;
set have;
retain row;
if field='ID' then row=Value;
run;

proc transpose data=addID out=want ;
by row;
id field;
var value;
run;

proc print data=want;run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Jul 2022 22:35:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-table-with-rows-representing-fields-into/m-p/821944#M324520</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-06T22:35:42Z</dc:date>
    </item>
  </channel>
</rss>

