<?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 PROC TRANSPOSE Multiple Columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642265#M191571</link>
    <description>&lt;P&gt;Hi.&amp;nbsp; I'm trying to transpose the data in my 'have' to my 'want' datasets (tables can be built from the code below).&amp;nbsp; Is it possible to group by the CLAIM_JOB_ID and have all the INC_MTR_NO's and QTY's on one line?&amp;nbsp; I've looked at many of these types of posts and haven't found one that's quite the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;infile&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;delimiter&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;','&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;dsd&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; claim_job_id &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; inc_mtr_no &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Qty &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; claim_job_id inc_mtr_no Qty ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;7698-2720K-282-1,990950,100&lt;/P&gt;&lt;P&gt;7698-2720K-282-1,GRO836029,100&lt;/P&gt;&lt;P&gt;7698-2826K-316292-2,FV HC19350,10&lt;/P&gt;&lt;P&gt;7698-2826K-316292-2,FV HC19375,10&lt;/P&gt;&lt;P&gt;7698-2826K-317055-3,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-317055-3,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-317108-2,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-317108-2,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-319505-1,FV HC19350,10&lt;/P&gt;&lt;P&gt;7698-2826K-319505-1,FV HC19375,10&lt;/P&gt;&lt;P&gt;7698-2826K-325714-8,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-325714-8,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-331417-1,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-331417-1,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-331425-1,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-331425-1,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-331425-1,GRO833133,50&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;infile&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;delimiter&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;','&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;dsd&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CLAIM_JOB_ID INC_MTR_NO1 Qty1 INC_MTR_NO2 Qty2 INC_MTR_NO3 Qty3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CLAIM_JOB_ID &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$20.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;INC_MTR_NO1 INC_MTR_NO2 INC_MTR_NO3 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$10.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Qty1 Qty2 Qty3 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CLAIM_JOB_ID INC_MTR_NO1 Qty1 INC_MTR_NO2 Qty2 INC_MTR_NO3 Qty3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;7698-2720K-282-1,990950,100,GRO836029,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-316292-2,FV HC19350,10,FV HC19375,10,,&lt;/P&gt;&lt;P&gt;7698-2826K-317055-3,GRO833100,100,GRO833101,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-317108-2,GRO833100,100,GRO833101,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-319505-1,FV HC19350,10,FV HC19375,10,,&lt;/P&gt;&lt;P&gt;7698-2826K-325714-8,GRO833100,100,GRO833101,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-331417-1,GRO833100,100,GRO833101,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-331425-1,GRO833100,100,GRO833101,100,GRO833133,50&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Apr 2020 14:46:22 GMT</pubDate>
    <dc:creator>bendsteel6</dc:creator>
    <dc:date>2020-04-23T14:46:22Z</dc:date>
    <item>
      <title>PROC TRANSPOSE Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642265#M191571</link>
      <description>&lt;P&gt;Hi.&amp;nbsp; I'm trying to transpose the data in my 'have' to my 'want' datasets (tables can be built from the code below).&amp;nbsp; Is it possible to group by the CLAIM_JOB_ID and have all the INC_MTR_NO's and QTY's on one line?&amp;nbsp; I've looked at many of these types of posts and haven't found one that's quite the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;infile&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;delimiter&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;','&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;dsd&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; claim_job_id &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; inc_mtr_no &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Qty &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; claim_job_id inc_mtr_no Qty ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;7698-2720K-282-1,990950,100&lt;/P&gt;&lt;P&gt;7698-2720K-282-1,GRO836029,100&lt;/P&gt;&lt;P&gt;7698-2826K-316292-2,FV HC19350,10&lt;/P&gt;&lt;P&gt;7698-2826K-316292-2,FV HC19375,10&lt;/P&gt;&lt;P&gt;7698-2826K-317055-3,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-317055-3,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-317108-2,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-317108-2,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-319505-1,FV HC19350,10&lt;/P&gt;&lt;P&gt;7698-2826K-319505-1,FV HC19375,10&lt;/P&gt;&lt;P&gt;7698-2826K-325714-8,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-325714-8,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-331417-1,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-331417-1,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-331425-1,GRO833100,100&lt;/P&gt;&lt;P&gt;7698-2826K-331425-1,GRO833101,100&lt;/P&gt;&lt;P&gt;7698-2826K-331425-1,GRO833133,50&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;infile&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;delimiter&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;','&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;dsd&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CLAIM_JOB_ID INC_MTR_NO1 Qty1 INC_MTR_NO2 Qty2 INC_MTR_NO3 Qty3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CLAIM_JOB_ID &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$20.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;INC_MTR_NO1 INC_MTR_NO2 INC_MTR_NO3 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$10.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Qty1 Qty2 Qty3 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CLAIM_JOB_ID INC_MTR_NO1 Qty1 INC_MTR_NO2 Qty2 INC_MTR_NO3 Qty3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;7698-2720K-282-1,990950,100,GRO836029,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-316292-2,FV HC19350,10,FV HC19375,10,,&lt;/P&gt;&lt;P&gt;7698-2826K-317055-3,GRO833100,100,GRO833101,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-317108-2,GRO833100,100,GRO833101,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-319505-1,FV HC19350,10,FV HC19375,10,,&lt;/P&gt;&lt;P&gt;7698-2826K-325714-8,GRO833100,100,GRO833101,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-331417-1,GRO833100,100,GRO833101,100,,&lt;/P&gt;&lt;P&gt;7698-2826K-331425-1,GRO833100,100,GRO833101,100,GRO833133,50&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 14:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642265#M191571</guid>
      <dc:creator>bendsteel6</dc:creator>
      <dc:date>2020-04-23T14:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642270#M191572</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28768"&gt;@bendsteel6&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an approach to achieve this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=_want1 (drop=_:) prefix=inc_mtr_no;
	var inc_mtr_no;
	by claim_job_id;
run;
proc transpose data=have out=_want2 (drop=_:) prefix=Qty;
	var Qty;
	by claim_job_id;
run;
data want;
	merge _want1 _want2;
	by claim_job_id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My best,&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 14:56:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642270#M191572</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-04-23T14:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642291#M191574</link>
      <description>&lt;P&gt;Hi, thanks for your quick response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this will give me the following columns:&lt;/P&gt;&lt;P&gt;CLAIM_JOB_ID&amp;nbsp; INC_MTR_NO1&amp;nbsp; INC_MTR_NO2&amp;nbsp; INC_MTR_NO3&amp;nbsp; QTY1&amp;nbsp; QTY2&amp;nbsp; QTY3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need them in this order:&lt;/P&gt;&lt;P&gt;CLAIM_JOB_ID&amp;nbsp; INC_MTR_NO1&amp;nbsp; QTY1&amp;nbsp; INC_MTR_NO2&amp;nbsp; QTY2&amp;nbsp; INC_MTR_NO3&amp;nbsp; QTY3 (and possibly more if the 'have' dataset has more than 3 instances of the BY variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess I should've specified this at the start...sorry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would there be an easy way to fix this?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 15:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642291#M191574</guid>
      <dc:creator>bendsteel6</dc:creator>
      <dc:date>2020-04-23T15:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642313#M191580</link>
      <description>&lt;P&gt;A simple retain statement would let you reorder the variables.&lt;/P&gt;
&lt;P&gt;e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  retain claim_job_id inc_mtr_no1 Qty1 inc_mtr_no2 Qty2 inc_mtr_no3 Qty3;
  set want;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Conversely, the following will do the task and output the variables in the desired order:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tr url 'https://raw.githubusercontent.com/art297/transpose/master/transpose.sas';
%include tr ;

%transpose(data=have, out=want, by=claim_job_id,
  var=inc_mtr_no Qty)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 15:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642313#M191580</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2020-04-23T15:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642343#M191589</link>
      <description>&lt;P&gt;Here is another more approach&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines delimiter=',' dsd;
	length claim_job_id $20. inc_mtr_no $10. Qty $3.;
	input claim_job_id inc_mtr_no Qty;
	datalines;
7698-2720K-282-1,990950,100
7698-2720K-282-1,GRO836029,100
7698-2826K-316292-2,FV HC19350,10
7698-2826K-316292-2,FV HC19375,10
7698-2826K-317055-3,GRO833100,100
7698-2826K-317055-3,GRO833101,100
7698-2826K-317108-2,GRO833100,100
7698-2826K-317108-2,GRO833101,100
7698-2826K-319505-1,FV HC19350,10
7698-2826K-319505-1,FV HC19375,10
7698-2826K-325714-8,GRO833100,100
7698-2826K-325714-8,GRO833101,100
7698-2826K-331417-1,GRO833100,100
7698-2826K-331417-1,GRO833101,100
7698-2826K-331425-1,GRO833100,100
7698-2826K-331425-1,GRO833101,100
7698-2826K-331425-1,GRO833133,50
;
run;

/* Find the records count by the ID variable */&lt;BR /&gt;proc sql noprint;
	select distinct count(claim_job_id) into :g_max separated by ',' from have 
		group by claim_job_id;
quit;
&lt;BR /&gt;/* Get the maximum count of records */
%put &amp;amp;=g_max;
%let g_max=%sysfunc(max(&amp;amp;g_max));
%put &amp;amp;=g_max;
&lt;BR /&gt;/* Declare iteration macro program for use within RETAIN Statement */
%macro iterate();
	%do v=1 %to &amp;amp;g_max;
		inc_mtr_no&amp;amp;v qty&amp;amp;v
	%end;
%mend;

data want(DROP=inc_mtr_no qty i);
	RETAIN claim_job_id %iterate;
	ARRAY inc_mtr_nos {3} $10 inc_mtr_no1-inc_mtr_no&amp;amp;g_max;
	ARRAY qties {3} $3 qty1-qty&amp;amp;g_max;

	do until (last.claim_job_id);
		set have;
		by claim_job_id;
		i+1;
		inc_mtr_nos[i]=inc_mtr_no;
		qties[i]=qty;
	end;
	i=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 17:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642343#M191589</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2020-04-23T17:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642461#M191663</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28768"&gt;@bendsteel6&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have adapted the program to get the columns in the "right" order:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=_want1 (drop=_:) prefix=inc_mtr_no;
	var inc_mtr_no;
	by claim_job_id;
run;
proc transpose data=have out=_want2 (drop=_:) prefix=Qty;
	var Qty;
	by claim_job_id;
run;

proc sql noprint;
	select name
	into: list_var separated by " "
	from dictionary.columns
	where libname = "WORK" and memname in ("_WANT1", "_WANT2") and name ne "claim_job_id"
	order by substr(name, length(name));
quit;

data want;
	retain claim_job_id &amp;amp;list_var.;
	merge _want1 _want2;
	by claim_job_id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture d’écran 2020-04-24 à 08.53.39.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/38624i94ABFF628604F08F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-04-24 à 08.53.39.png" alt="Capture d’écran 2020-04-24 à 08.53.39.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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 06:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642461#M191663</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-04-24T06:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642535#M191700</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for this.&amp;nbsp; Works perfectly!&amp;nbsp; The other solutions also work but I'll use this as it gives me much more flexibility in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 11:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-Multiple-Columns/m-p/642535#M191700</guid>
      <dc:creator>bendsteel6</dc:creator>
      <dc:date>2020-04-24T11:48:26Z</dc:date>
    </item>
  </channel>
</rss>

