<?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 to transpose the following table without using proc transpose? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552046#M153457</link>
    <description>&lt;P&gt;Try replacing the proc sql with the following data step :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
    set have(keep=ID);
    by ID;
    retain nfac;

    if _N_=1 then nfac=0;

    if first.ID then i=1;
    else i+1;

    if last.ID and i&amp;gt;nfac then do;
        nfac=i;
        call symputx("nfac", nfac);
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Apr 2019 10:10:35 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2019-04-18T10:10:35Z</dc:date>
    <item>
      <title>how to transpose the following table without using proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552031#M153449</link>
      <description>&lt;P&gt;I want to transpose the following table without using proc transpose:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original Table:&lt;/P&gt;&lt;P&gt;ID facility&lt;/P&gt;&lt;P&gt;1&amp;nbsp; Swimming Pool&lt;/P&gt;&lt;P&gt;1&amp;nbsp; SPA&lt;/P&gt;&lt;P&gt;2&amp;nbsp; Gym room&lt;/P&gt;&lt;P&gt;2&amp;nbsp; restaurant&lt;/P&gt;&lt;P&gt;2&amp;nbsp; bar&lt;/P&gt;&lt;P&gt;3&amp;nbsp; Room&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected Table:&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; facility_1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;facility_2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;facility_3&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; Swimming Pool&amp;nbsp; &amp;nbsp; SPA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; Gym room&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; restaurant&amp;nbsp; &amp;nbsp; &amp;nbsp;bar&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; Room&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The number of facilities for each ID is unknown.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help me out?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 08:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552031#M153449</guid>
      <dc:creator>Jonathanzz</dc:creator>
      <dc:date>2019-04-18T08:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to transpose the following table without using proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552035#M153450</link>
      <description>What's wrong with proc transpose ?</description>
      <pubDate>Thu, 18 Apr 2019 09:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552035#M153450</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-04-18T09:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to transpose the following table without using proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552036#M153451</link>
      <description>&lt;P&gt;I am going to transpose the dataset inside SAS enterprise miner using code editor, Howeve, it seems SAS enterprise miner does not support proc transpose.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 09:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552036#M153451</guid>
      <dc:creator>Jonathanzz</dc:creator>
      <dc:date>2019-04-18T09:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to transpose the following table without using proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552039#M153453</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    length facility $20.;
    infile cards dlm=',' dsd;
    input ID facility;
    cards;
1,Swimming Pool
1,SPA
2,Gym room
2,restaurant
2,bar
3,Room
    ;
run;

proc sql noprint;
    SELECT max(nfac) INTO :nfac TRIMMED
    FROM (
    SELECT count(facility) AS nfac
    FROM have
    GROUP BY ID
    )
    ;
quit;

data want;
    set have;
    by ID;
    retain facility1-facility&amp;amp;nfac.;

    array fac(&amp;amp;nfac.) $20. facility1-facility&amp;amp;nfac.;

    if first.ID then do;
        call missing(of fac(*));
        i=1;
    end;
    else i+1;

    fac(i)=facility;

    if last.ID;

    drop i facility;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Apr 2019 09:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552039#M153453</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-04-18T09:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to transpose the following table without using proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552043#M153455</link>
      <description>Thanks Gamotte!&lt;BR /&gt;I have one more request. Can it be done without using PROC statement and only using data step since SAS Enterprise Miner do not support any PROC statement.&lt;BR /&gt;Thank you so much!!!</description>
      <pubDate>Thu, 18 Apr 2019 09:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552043#M153455</guid>
      <dc:creator>Jonathanzz</dc:creator>
      <dc:date>2019-04-18T09:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to transpose the following table without using proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552046#M153457</link>
      <description>&lt;P&gt;Try replacing the proc sql with the following data step :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
    set have(keep=ID);
    by ID;
    retain nfac;

    if _N_=1 then nfac=0;

    if first.ID then i=1;
    else i+1;

    if last.ID and i&amp;gt;nfac then do;
        nfac=i;
        call symputx("nfac", nfac);
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 10:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-transpose-the-following-table-without-using-proc/m-p/552046#M153457</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-04-18T10:10:35Z</dc:date>
    </item>
  </channel>
</rss>

