<?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 TRASPOSE INTO ONE ROW in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/771982#M31020</link>
    <description>&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Dear, I hope you are very well, I have a problem that I hope you can help me. My data is as follows,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Andres_Fuentes1_0-1633370507619.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64354i1A73385F8AB84531/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Andres_Fuentes1_0-1633370507619.png" alt="Andres_Fuentes1_0-1633370507619.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;and I need to transform it in a single row by ID. like the following example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Andres_Fuentes1_1-1633370570033.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64355i4C99F118265CC304/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Andres_Fuentes1_1-1633370570033.png" alt="Andres_Fuentes1_1-1633370570033.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Oct 2021 18:09:54 GMT</pubDate>
    <dc:creator>Andres_Fuentes1</dc:creator>
    <dc:date>2021-10-04T18:09:54Z</dc:date>
    <item>
      <title>TRASPOSE INTO ONE ROW</title>
      <link>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/771982#M31020</link>
      <description>&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Dear, I hope you are very well, I have a problem that I hope you can help me. My data is as follows,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Andres_Fuentes1_0-1633370507619.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64354i1A73385F8AB84531/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Andres_Fuentes1_0-1633370507619.png" alt="Andres_Fuentes1_0-1633370507619.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;and I need to transform it in a single row by ID. like the following example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Andres_Fuentes1_1-1633370570033.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64355i4C99F118265CC304/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Andres_Fuentes1_1-1633370570033.png" alt="Andres_Fuentes1_1-1633370570033.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 18:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/771982#M31020</guid>
      <dc:creator>Andres_Fuentes1</dc:creator>
      <dc:date>2021-10-04T18:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: TRASPOSE INTO ONE ROW</title>
      <link>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/771989#M31021</link>
      <description>&lt;P&gt;Hi, two approaches.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $ profile $ type music $;
cards;
A NICE  1 ROCK
A SAD   2 JAZZ
A SAD   1 ROCK
A HAPPY 2 POP
B NICE  1 ROCK
B SAD   2 JAZZ
B SAD   1 ROCK
B HAPPY 2 POP
B HAPPY 3 METAL
;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = have out = have1 prefix=profile;
  by id;
  var profile;
run;
proc transpose data = have out = have2 prefix=type;
  by id;
  var type;
run;
proc transpose data = have out = have3 prefix=music;
  by id;
  var music;
run;

data want;
  merge have1 have2 have3;
  by id;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Two:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have_v / view = have_v;
  set have;
  by id;
  if first.id then order = 0;
  order + 1;
run;
proc print data = have_v;
run;


proc transpose data = have_v out = have_v2;
  by ID order;
  var profile type music;
run;
proc print;
run;

proc transpose data = have_v2 out = have_v3(drop = _name_) ;
  by ID;
  var col1;
  id _name_ order;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 18:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/771989#M31021</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-10-04T18:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: TRASPOSE INTO ONE ROW</title>
      <link>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/771990#M31022</link>
      <description>&lt;P&gt;You might consider leaving the data in a long data set, as many times this is easier to work with than a wide data set. What tasks are you planning on performing after the TRANSPOSE?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 18:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/771990#M31022</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-04T18:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: TRASPOSE INTO ONE ROW</title>
      <link>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/772077#M31034</link>
      <description>&lt;PRE&gt;data have;
input id $ profile $ type music $;
cards;
A NICE  1 ROCK
A SAD   2 JAZZ
A SAD   1 ROCK
A HAPPY 2 POP
B NICE  1 ROCK
B SAD   2 JAZZ
B SAD   1 ROCK
B HAPPY 2 POP
B HAPPY 3 METAL
;
data have;
 set have;
 by id;
 if first.id then n=0;
 n+1;
run;
proc sql noprint;
select distinct catt('have(where=(n=',n,') rename=(
 profile=profile',n,' type=type',n,' music=music',n,'))') into : merge separated by ' '
from have;
quit;
data want;
 merge &amp;amp;merge;
 by id;
 drop n;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Oct 2021 07:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/772077#M31034</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-10-05T07:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: TRASPOSE INTO ONE ROW</title>
      <link>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/772080#M31035</link>
      <description>&lt;P&gt;By adding a profile count, you can have PROC REPORT create output along your intentions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $ profile $ type music $;
cards;
A NICE  1 ROCK
A SAD   2 JAZZ
A SAD   1 ROCK
A HAPPY 2 POP
B NICE  1 ROCK
B SAD   2 JAZZ
B SAD   1 ROCK
B HAPPY 2 POP
B HAPPY 3 METAL
;

data extend;
set have;
by id;
if first.id
then profct = 1;
else profct + 1;
run;

options missing = " ";

proc report data=extend;
column id profct,(profile type music) n;
define id / group;
define profile / display;
define type / display;
define music / display;
define profct / "" across;
define n / noprint;
run;

options missing = ".";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Oct 2021 07:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/TRASPOSE-INTO-ONE-ROW/m-p/772080#M31035</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-05T07:39:59Z</dc:date>
    </item>
  </channel>
</rss>

