<?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: Transpose data using array or proc tranpose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244607#M45583</link>
    <description>&lt;P&gt;I believe should have included one more line in the input which make it tuff not to use the hardcoded value..so as in below example i added one more row so with the change of susbsy variable(which is first 5 digit no.) it's no guarantee we will have same column values..&lt;/P&gt;
&lt;P&gt;So example as below when 98909 came in the things changed ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Input Data&lt;BR /&gt;-----------&lt;BR /&gt;53809,09,01-SEP-2015,0:15,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,0:30,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,0:45,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,1:00,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;98909,09,01-SEP-2015,0:15,4,2MA,1,2MB,1,3ME,3,3MF,1,3MC,1,4MD,1,4MG,1,5MH,2&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jan 2016 07:41:00 GMT</pubDate>
    <dc:creator>rkumar23</dc:creator>
    <dc:date>2016-01-20T07:41:00Z</dc:date>
    <item>
      <title>Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244603#M45580</link>
      <description>&lt;P&gt;Can somebody give a thought how it will be easier to get below output...&lt;/P&gt;
&lt;P&gt;I have input data as below :&lt;/P&gt;
&lt;P&gt;--------------&lt;/P&gt;
&lt;P&gt;Input Data&lt;BR /&gt;--------------&lt;BR /&gt;53809,09,01-SEP-2015,0:15,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,0:30,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,0:45,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,1:00,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I am looking if I could have output something like below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;---------------------&lt;/P&gt;
&lt;P&gt;Output Desired:&lt;/P&gt;
&lt;P&gt;---------------------&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;SUBSYS,Month,Date,Time,#Blades,1MA,1MB,1ME,1MF,2MC,2MD,2MC,2MH&lt;BR /&gt;53809,09,01-SEP-2015,0:15,8,1,1,2,1,1,1,1,2&lt;BR /&gt;53809,09,01-SEP-2015,0:30,8,1,1,2,1,1,1,1,2&lt;BR /&gt;53809,09,01-SEP-2015,0:45,8,1,1,3,1,1,1,1,3&lt;BR /&gt;53809,09,01-SEP-2015,1:00,8,1,1,3,1,1,1,1,2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So basically as you see the 1MA,1MB etc get the heading and then corresponding values get at the bottom of those 1MA,1MB ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see there's possibility to have it done using the Proc transpose or array can be done however don't seems to come out exactly...&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 07:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244603#M45580</guid>
      <dc:creator>rkumar23</dc:creator>
      <dc:date>2016-01-20T07:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244606#M45582</link>
      <description>&lt;P&gt;If the data in the records is always ordered in the same manner, you just read the file and drop the columns that contain the 1MA, 1MB and so on.&lt;/P&gt;
&lt;P&gt;Have the remaining columns named appropriately and proc export will give you your desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the order is not consistent, you will need to read the data into columns that are grouped into arrays (one for names, one for values), so you can evaluate and assign the name/value pairs in a do loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, which is it?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 07:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244606#M45582</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-20T07:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244607#M45583</link>
      <description>&lt;P&gt;I believe should have included one more line in the input which make it tuff not to use the hardcoded value..so as in below example i added one more row so with the change of susbsy variable(which is first 5 digit no.) it's no guarantee we will have same column values..&lt;/P&gt;
&lt;P&gt;So example as below when 98909 came in the things changed ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Input Data&lt;BR /&gt;-----------&lt;BR /&gt;53809,09,01-SEP-2015,0:15,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,0:30,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,0:45,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,1:00,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;98909,09,01-SEP-2015,0:15,4,2MA,1,2MB,1,3ME,3,3MF,1,3MC,1,4MD,1,4MG,1,5MH,2&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 07:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244607#M45583</guid>
      <dc:creator>rkumar23</dc:creator>
      <dc:date>2016-01-20T07:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244615#M45586</link>
      <description>&lt;P&gt;So we need to go the hard way &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let maxpair=8;

data have;
infile cards dlm=',' missover;
informat
  subsys 5.
  month 2.
  date date11.
  time time6.
;
format
  date date11.
  time time6.
;
length name1-name&amp;amp;maxpair $3;
array names {&amp;amp;maxpair} name1-name&amp;amp;maxpair;
array values {&amp;amp;maxpair} value1-value&amp;amp;maxpair;
input
  subsys
  month
  date
  time
  nr_blades
  %macro name_value;
  %do i = 1 %to &amp;amp;maxpair;
  name&amp;amp;i
  value&amp;amp;i
  %end;
  %mend;
  %name_value
;
do i = 1 to &amp;amp;maxpair;
  if names{i} ne '' then do;
    name = names{i};
    value = values{i};
    output;
  end;
end;
keep subsys month date time nr_blades name value;
cards;
53809,09,01-SEP-2015,0:15,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2
53809,09,01-SEP-2015,0:30,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2
53809,09,01-SEP-2015,0:45,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,3
53809,09,01-SEP-2015,1:00,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2
98909,09,01-SEP-2015,0:15,4,2MA,1,2MB,1,3ME,3,3MF,1,3MC,1,4MD,1,4MG,1,5MH,2
;
run;

proc transpose data=have out=want;
id name;
var value;
by subsys month date time nr_blades notsorted;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2016 08:01:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244615#M45586</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-20T08:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244620#M45587</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover dsd ;
input (SUBSYS Month Date Time Blades a b) ( : $20.) @;
n+1;
do while(not missing(a));
 output;
 input (a b) (: $20.) @;
end;
cards;
53809,09,01-SEP-2015,0:15,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2     
53809,09,01-SEP-2015,0:30,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2     
53809,09,01-SEP-2015,0:45,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,3     
53809,09,01-SEP-2015,1:00,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2
;
run;
proc transpose data=have out=want(drop=_name_);
by n SUBSYS Month Date Time Blades;
id a;
var b;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2016 08:41:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244620#M45587</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-20T08:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244625#M45588</link>
      <description>&lt;P&gt;Thanks, seems to work upto certain extend however when the value of name changes by subsys they are getting added as an extra column instead of replacing the names by subsys which crate issue as by subsys as names are very variable the row length with adding the columns are getting extended to very long length...&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 08:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244625#M45588</guid>
      <dc:creator>rkumar23</dc:creator>
      <dc:date>2016-01-20T08:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244627#M45589</link>
      <description>&lt;P&gt;Well, if you have n distinct names, you get n columns. Nothing surprising about that.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 09:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244627#M45589</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-20T09:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244628#M45590</link>
      <description>&lt;P&gt;Sorry this doesn't help...&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 09:08:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244628#M45590</guid>
      <dc:creator>rkumar23</dc:creator>
      <dc:date>2016-01-20T09:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244630#M45591</link>
      <description>&lt;P&gt;Then please post the desired output for&lt;/P&gt;
&lt;P&gt;53809,09,01-SEP-2015,0:15,8,1MA,1,1MB,1,1ME,2,1MF,&lt;WBR /&gt;1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,0:30,8,1MA,1,1MB,1,1ME,2,1MF,&lt;WBR /&gt;1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,0:45,8,1MA,1,1MB,1,1ME,3,1MF,&lt;WBR /&gt;1,2MC,1,2MD,1,2MG,1,2MH,3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;53809,09,01-SEP-2015,1:00,8,1MA,1,1MB,1,1ME,3,1MF,&lt;WBR /&gt;1,2MC,1,2MD,1,2MG,1,2MH,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;98909,09,01-SEP-2015,0:15,4,2MA,1,2MB,1,3ME,3,3MF,&lt;WBR /&gt;1,3MC,1,4MD,1,4MG,1,5MH,2&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 09:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244630#M45591</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-20T09:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244631#M45592</link>
      <description>&lt;P&gt;Hi Kurt, in that case is it possible by SUBSYS we create the column heading for the names?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 09:10:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244631#M45592</guid>
      <dc:creator>rkumar23</dc:creator>
      <dc:date>2016-01-20T09:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244632#M45593</link>
      <description>&lt;P&gt;Looking something like this, so with subsys change the blades name change as well...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Output Looking:&lt;BR /&gt;SUBSYS,MONTH,DATE,TIME,#Blades,1MA,1MB,1ME,1MF,2MC,2MD,2MC,2MH&lt;BR /&gt;53809,09,01-SEP-2015,0:15,8,1,1,2,1,1,1,1,2&lt;BR /&gt;53809,09,01-SEP-2015,0:30,8,1,1,2,1,1,1,1,2&lt;BR /&gt;53809,09,01-SEP-2015,0:45,8,1,1,3,1,1,1,1,3&lt;BR /&gt;53809,09,01-SEP-2015,1:00,8,1,1,3,1,1,1,1,2&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;SUBSYS,MONTH,DATE,TIME,#Blades,2MA,2MB,3ME,3MF,3MC,4MD,4MG,5MH&lt;BR /&gt;98909,09,01-SEP-2015,0:15,4,1,1,3,1,1,1,1,2&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 09:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244632#M45593</guid>
      <dc:creator>rkumar23</dc:creator>
      <dc:date>2016-01-20T09:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244633#M45594</link>
      <description>&lt;P&gt;Consider this method:&lt;/P&gt;
&lt;P&gt;After initially reading the data into the long format, determine the distinct subsys's. (proc sort nodupkey)&lt;/P&gt;
&lt;P&gt;Then create an empty output file with a data _null_;&lt;/P&gt;
&lt;P&gt;Then work through the list of subsys's and use call execute to dynamically apply the transpose method for every single subsys, and add code in each iteration that appends a new header line and the data to the output file.&lt;/P&gt;
&lt;P&gt;But you clearly cannot put all the data into one SAS dataset in wide format without getting a large number of columns.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 09:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244633#M45594</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-20T09:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244635#M45595</link>
      <description>&lt;P&gt;So you need the uniform variable name no matter what it is in obs ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover dsd ;
input (SUBSYS Month Date Time Blades x b) ( : $20.) @;
length a $ 20;
n+1;
idx=1;
a=cats('XX',idx);
do while(not missing(x));
 output;
 input (x b) (: $20.) @;
 idx+1;
 a=cats('XX',idx);
end;
drop idx x;
cards;
53809,09,01-SEP-2015,0:15,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2     
53809,09,01-SEP-2015,0:30,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2     
53809,09,01-SEP-2015,0:45,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,3     
53809,09,01-SEP-2015,1:00,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2
98909,09,01-SEP-2015,0:15,4,2MA,1,2MB,1,3ME,3,3MF,1,3MC,1,4MD,1,4MG,1,5MH,2
;
run;
proc transpose data=have out=want(drop=_name_);
by n SUBSYS Month Date Time Blades;
id a;
var b;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2016 09:37:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244635#M45595</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-20T09:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose data using array or proc tranpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244636#M45596</link>
      <description>&lt;P&gt;Is it true, that your just want to swith column titles on channging "subsys"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let NumOfPairs = 8;

options mprint;

%macro NameValuePairs;
   %local i;
   %do i = 1 %to &amp;amp;NumOfPairs;
      Name&amp;amp;i Value&amp;amp;i
   %end;
%mend;

data work.have;

   length 
      subsys month date time no_blades 8
      Name1-Name&amp;amp;NumOfPairs $ 3
      Value1-Value&amp;amp;NumOfPairs 8
   ;

   informat date date11. time time6.;
   format month z2. date date11. time time6.;

   infile datalines delimiter=",";

   input subsys month date time no_blades 
      %NameValuePairs;
   ;

datalines;
53809,09,01-SEP-2015,0:15,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2    
53809,09,01-SEP-2015,0:30,8,1MA,1,1MB,1,1ME,2,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2    
53809,09,01-SEP-2015,0:45,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,3    
53809,09,01-SEP-2015,1:00,8,1MA,1,1MB,1,1ME,3,1MF,1,2MC,1,2MD,1,2MG,1,2MH,2    
98909,09,01-SEP-2015,0:15,4,2MA,1,2MB,1,3ME,3,3MF,1,3MC,1,4MD,1,4MG,1,5MH,2
;
run;


data _null_;
   set work.have;
   by subsys;

   length line $ 250;

   file "PATH-TO-FILE" delimiter=",";

   if first.subsys then do;
      line = catx(",", "SUBSYS,Month,Date,Time,#Blades", of name:);
      put line;
   end;

   put subsys month date time no_blades value1-value&amp;amp;NumOfPairs;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Removes useless array definitions.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 10:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-data-using-array-or-proc-tranpose/m-p/244636#M45596</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2016-01-20T10:17:07Z</dc:date>
    </item>
  </channel>
</rss>

