<?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: Proc Transpose in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-Transpose/m-p/894903#M43697</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Just for having some fun*/
data have;
input ID $ TYPE $ TYPE_ID;
datalines;
1 A 1
1 B 1
1 c 1
1 d 1
1 e 1
1 f 1
1 g 2
1 h 2
1 j 2
1 k 2
1 l 2
1 q 3
1 w 3
1 e 3
1 r 3
1 t 3
1 y 4
1 u 4
1 i 4
;
run;
proc sql noprint;
select distinct catt('have(where=(TYPE_ID=',TYPE_ID,') rename=(type=_',TYPE_ID,'))')
      into :merge separated by ' '
 from have;
quit;
data want;
 merge &amp;amp;merge.;
 by id;
 output;
 call missing(of _all_);
 drop TYPE_ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Sep 2023 11:36:44 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2023-09-19T11:36:44Z</dc:date>
    <item>
      <title>Proc Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-Transpose/m-p/894752#M43691</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Sample data */
data have;
input ID $ TYPE $ TYPE_ID;
datalines;
1 A 1
1 B 1
1 c 1
1 d 1
1 e 1
1 f 1
1 g 2
1 h 2
1 j 2
1 k 2
1 l 2
1 q 3
1 w 3
1 e 3
1 r 3
1 t 3
1 y 4
1 u 4
1 i 4
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Desired Output
ID    1       2       3        4
1     A        g        q        y
1     B        h        w        u
1     c        j        e        i
1     d        k        r
1     e        l        t
1     f&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;i need to transpose data&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=haveout=youroutput prefix=ID_;
  by ID;
  var TYPE;
  id TYPE_ID;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2023 08:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-Transpose/m-p/894752#M43691</guid>
      <dc:creator>Daily1</dc:creator>
      <dc:date>2023-09-18T08:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-Transpose/m-p/894754#M43692</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pretrans;
set have;
by id type_id;
if first.type_id
then group = 1;
else group + 1;
run;

proc sort data=pretrans;
by id group;
run;

proc transpose
  data=pretrans
  out=want
;
by id group;
var type;
if type_id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;as you can't have multiple identical ID (the statement!) values within a BY group of PROC TRANSPOSE, so you must create a new group for this.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 09:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-Transpose/m-p/894754#M43692</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-18T09:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-Transpose/m-p/894903#M43697</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Just for having some fun*/
data have;
input ID $ TYPE $ TYPE_ID;
datalines;
1 A 1
1 B 1
1 c 1
1 d 1
1 e 1
1 f 1
1 g 2
1 h 2
1 j 2
1 k 2
1 l 2
1 q 3
1 w 3
1 e 3
1 r 3
1 t 3
1 y 4
1 u 4
1 i 4
;
run;
proc sql noprint;
select distinct catt('have(where=(TYPE_ID=',TYPE_ID,') rename=(type=_',TYPE_ID,'))')
      into :merge separated by ' '
 from have;
quit;
data want;
 merge &amp;amp;merge.;
 by id;
 output;
 call missing(of _all_);
 drop TYPE_ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Sep 2023 11:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-Transpose/m-p/894903#M43697</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-09-19T11:36:44Z</dc:date>
    </item>
  </channel>
</rss>

