<?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 - order ID in proper sequence in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102234#M291104</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone. let me try the optoins mention by all of you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Aug 2012 10:58:28 GMT</pubDate>
    <dc:creator>KrunalPatel</dc:creator>
    <dc:date>2012-08-30T10:58:28Z</dc:date>
    <item>
      <title>Proc Transpose - order ID in proper sequence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102230#M291100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anybody can please guide me how can I sequence the ID in proper order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;I want to traspose below "Table1":&lt;/P&gt;&lt;P&gt;I want to transpose as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc Transpose data= Table1 out=Table2;&lt;/P&gt;&lt;P&gt;by Code;&lt;/P&gt;&lt;P&gt;id Mth;&lt;/P&gt;&lt;P&gt;var Pay;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while doing this i am not getting my ID in sequence&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 192px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&amp;nbsp; &lt;TD class="xl66" height="20" width="64"&gt;Code&lt;/TD&gt;&amp;nbsp; &lt;TD class="xl66" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="64"&gt;Mth&lt;/TD&gt;&amp;nbsp; &lt;TD class="xl66" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="64"&gt;Pay&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;1&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;12&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;DEF&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;12&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;XYZ&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;1&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;34&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;23&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;DEF&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;1&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;45&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;XYZ&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;65&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;5&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;6&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;4&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;12&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&amp;nbsp; &lt;TD class="xl65" height="20" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&amp;nbsp; &lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;3&lt;/TD&gt;&amp;nbsp; Table1:&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;34&lt;/TD&gt; &lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 10:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102230#M291100</guid>
      <dc:creator>KrunalPatel</dc:creator>
      <dc:date>2012-08-23T10:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - order ID in proper sequence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102231#M291101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is that the order of the ID variables is determined by the order they appear in the input dataset.&amp;nbsp; You could solve the problem in your example data just by sorting table1 by Code and Mth, however this won't necessarily work in your real data.&amp;nbsp; There is no way I know of where you can specify the order of the variables within PROC TRANSPOSE, so one of your options is to reorder the output dataset afterwards.&amp;nbsp; Here's one way of doing that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data table1;&lt;/P&gt;&lt;P&gt;input Code $ Mth Pay;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;ABC 1 12&lt;/P&gt;&lt;P&gt;DEF 2 12&lt;/P&gt;&lt;P&gt;XYZ 1 34&lt;/P&gt;&lt;P&gt;ABC 2 23&lt;/P&gt;&lt;P&gt;DEF 1 45&lt;/P&gt;&lt;P&gt;XYZ 2 65&lt;/P&gt;&lt;P&gt;ABC 5 6&lt;/P&gt;&lt;P&gt;ABC 4 12&lt;/P&gt;&lt;P&gt;ABC 3 34&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=table1;&lt;/P&gt;&lt;P&gt;by code;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc Transpose data=table1 out=table2 (drop=_:) prefix=Mth;&lt;/P&gt;&lt;P&gt;by Code;&lt;/P&gt;&lt;P&gt;id Mth;&lt;/P&gt;&lt;P&gt;var Pay;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select name into :vars separated by ','&lt;/P&gt;&lt;P&gt;from dictionary.columns&lt;/P&gt;&lt;P&gt;where libname='WORK' and upcase(memname)='TABLE2' and upcase(name) eqt 'MTH'&lt;/P&gt;&lt;P&gt;order by name;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table table2 as select&lt;/P&gt;&lt;P&gt;code,&lt;/P&gt;&lt;P&gt;&amp;amp;vars.&lt;/P&gt;&lt;P&gt;from table2;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 13:05:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102231#M291101</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2012-08-23T13:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - order ID in proper sequence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102232#M291102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure exactly what you want to end up with but, hopefully, the following will at least give you an idea.&amp;nbsp; p.s. the method shown below is from an old sas-l post by datanull (see: &lt;A href="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0910a&amp;amp;L=sas-l&amp;amp;D=0&amp;amp;P=21269" title="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0910a&amp;amp;L=sas-l&amp;amp;D=0&amp;amp;P=21269"&gt;SAS-L archives -- October 2009, week 1 (#177)&amp;lt;/title&amp;gt;&amp;lt;style type="text/css"&amp;gt;&amp;lt;!--BODY { font-family: "Comic Sans MS",arial, helvetica, sans-serif; font-size: 14px; color: black; background-color: white; }TD, TH, FONT, .BOD { font-family: "Comic Sans MS", arial, helvetica, sans-serif; font-size: 14px; margin-left: 0px; margin-right: 0px; color: black; }SUP { font-family: courier,monospace; font-size: 12px; text-decoration: none; }KBD {font-family: courier,monospace;}PRE {font-family: courier,monospace;} .SMALL {font-size: 12px} .SMALLER {font-size: 10px} .LARGE {font-size: 16px} .LARGER {font-size: 18px} .FOOT {font-size: 12px; color: gray } .BLOCK { font-size: 12px; color: #555555; text-align: justify; } .FIXED { font-family: courier,monospaced; font-size:12pt }STRONG {font-weight: bold }EM { font-style: italic; }A:LINK { text-decoration: none; color: #0000FF; }A:VISITED { text-decoration: none; color: #0000FF; }A:ACTIVE { text-decoration: none; color: #0000FF; }A:HOVER { text-decoration: none; color: #ad080a; }H1 { font-size: 22px; }H2 { font-size: 20px; }H3 { font-size: 18px; }--&amp;gt;&amp;lt;/style&amp;gt;&amp;lt;!-- This is the top part for sub pages (topsub.html) 12/10/99 16:05 --&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;LISTSERV at the University of Georgia ))&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data table1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Code $ Mth Pay;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;ABC 1 12&lt;/P&gt;&lt;P&gt;DEF 2 12&lt;/P&gt;&lt;P&gt;XYZ 3 34&lt;/P&gt;&lt;P&gt;ABC 2 23&lt;/P&gt;&lt;P&gt;DEF 1 45&lt;/P&gt;&lt;P&gt;XYZ 2 65&lt;/P&gt;&lt;P&gt;ABC 5 6&lt;/P&gt;&lt;P&gt;ABC 4 12&lt;/P&gt;&lt;P&gt;ABC 3 34&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc summary data=table1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=dateinfo(drop=_:) min(mth)=min max(mth)=max;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data table2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if 0 then set table1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set dateinfo;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do mth = min to max;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until(eof);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set table1 end=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=table2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by code;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=table2 out=want(where=(not missing(code))) prefix=mth;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by code;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var pay;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; id mth;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; idlabel mth;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 13:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102232#M291102</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-23T13:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - order ID in proper sequence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102233#M291103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Same idea, using SQL :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;data table1;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input Code $ Mth Pay;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cards;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;ABC 1 12&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;DEF 2 12&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;XYZ 3 34&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;ABC 2 23&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;DEF 1 45&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;XYZ 2 65&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;ABC 5 6&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;ABC 4 12&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;ABC 3 34&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;create table tableX as&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;select *&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;from (select unique a.code, b.mth from table1 as a, table1 as b)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; natural left join table1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;order by code, mth;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;proc transpose data=tableX out=want(drop=_NAME_) prefix=mth;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by code;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var pay;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id mth;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; idlabel mth;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: PG - simplified code, a bit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 13:30:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102233#M291103</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-08-23T13:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - order ID in proper sequence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102234#M291104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone. let me try the optoins mention by all of you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 10:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Transpose-order-ID-in-proper-sequence/m-p/102234#M291104</guid>
      <dc:creator>KrunalPatel</dc:creator>
      <dc:date>2012-08-30T10:58:28Z</dc:date>
    </item>
  </channel>
</rss>

