<?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: Reorder Variables produced in Array in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145344#M38637</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At the top of the program you place this magic&amp;nbsp; statement with&lt;/P&gt;&lt;P&gt;FORMAT var1 var2 var3 ..... var100;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note there are NO length specifications for the Variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This keeps the above order of the variables in the OUTPUT DATA SET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may use INFORMAT instead too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Jan 2015 05:05:56 GMT</pubDate>
    <dc:creator>KachiM</dc:creator>
    <dc:date>2015-01-30T05:05:56Z</dc:date>
    <item>
      <title>Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145341#M38634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using arrays to transpose my dataset from long to wide because there are several variables that need to remain together in the ultimate output. I don't always know the maximum number of observations per ID, so I first use SQL to find that max to set the Array dimensions as described in &lt;A href="http://www.lexjansen.com/nesug/nesug12/ff/ff01.pdf"&gt;this&lt;/A&gt; article. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far so good: I'm getting one row per ID as I want. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is, the variables are being output grouped by the order they're created (naturally): &lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#000000&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Acc_1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Acc_2, etc. ...&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date_1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date_2, etc., ...&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 12 total numbered variables and the current dataset came to a max of 8, so output of the current dataset is going to be 96 columns wide. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that the client would prefer to see the output grouped by the sets (could think of it as interlaced), so from the example above the preferred order would be: &lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Acc_1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date_1 (rest of _1 variables)&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Acc_2&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date_2, etc.&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions on how this can be done either in the data step that gathers the information into the arrays or in a subsequent step? I've thought about a macro that would write out a PROC SQL with the select statement being written with the variables in the preferred order however many times found previously to set the array dimensions, but that just seems overly complicated to how it feels it &lt;EM&gt;should&lt;/EM&gt; work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 02:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145341#M38634</guid>
      <dc:creator>CuseBruce</dc:creator>
      <dc:date>2015-01-30T02:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145342#M38635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One is by usage of the retain statement prior to the set statement for arranging the order of the variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain var1 var2 ..........;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 03:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145342#M38635</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-01-30T03:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145343#M38636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A macro variable is the key, by using the sashelp.vcolumn table to determine the order along with the retain statement. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 03:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145343#M38636</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-30T03:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145344#M38637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At the top of the program you place this magic&amp;nbsp; statement with&lt;/P&gt;&lt;P&gt;FORMAT var1 var2 var3 ..... var100;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note there are NO length specifications for the Variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This keeps the above order of the variables in the OUTPUT DATA SET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may use INFORMAT instead too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 05:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145344#M38637</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2015-01-30T05:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145345#M38638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SQL can order those variables as you will&amp;nbsp; via dictionary table . Post some sample data would be better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 07:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145345#M38638</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-30T07:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145346#M38639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SQL can order those variables as you will&amp;nbsp; via dictionary table . Post some sample data would be better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 07:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145346#M38639</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-30T07:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145347#M38640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are few post related to this topic. Here is one example:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/64769?start=0&amp;amp;tstart=0"&gt;https://communities.sas.com/thread/64769?start=0&amp;amp;tstart=0&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 08:56:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145347#M38640</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2015-01-30T08:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145348#M38641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestion, Jagadishkatam. I'm unsure how that will help, though, given each month this process runs has the potential to change the number of variables. This version might work this month, but if next month there are additional series, the program would need to be changed. Or am I missing a key point? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 17:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145348#M38641</guid>
      <dc:creator>CuseBruce</dc:creator>
      <dc:date>2015-01-30T17:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145349#M38642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This lead seems intriguing, though I'm not sure how to proceed in testing it. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 17:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145349#M38642</guid>
      <dc:creator>CuseBruce</dc:creator>
      <dc:date>2015-01-30T17:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145350#M38643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming your table is called HAVE and stored in the WORK library&lt;/P&gt;&lt;P&gt;You have two variables that start with ACC_i and DATE_i and you want them ordererd as ACC_1, DATE_1, ACC_2, DATE_2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have other variables that start with ACC or DATE that aren't part of the variable list you'll need to account for them some way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's some skeleton (untested) code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table test as&lt;/P&gt;&lt;P&gt;select name, varnum, input(scan(name, 2, "_"), 2.) as var_order&lt;/P&gt;&lt;P&gt;from sashelp.vcolumn &lt;/P&gt;&lt;P&gt;where upper(libname)="WORK" and upper(memname)="HAVE"&lt;/P&gt;&lt;P&gt;and (upper(name) like 'ACC%'&lt;/P&gt;&lt;P&gt;or upper(name) like 'DATE%')&lt;/P&gt;&lt;P&gt;order by var_order, name ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select trim(name) into :retain_list separated by " "&lt;/P&gt;&lt;P&gt;from test;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;retain &amp;amp;retain_list;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 17:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145350#M38643</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-30T17:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145351#M38644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia. Here is the code being used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data RIS_BASE_MAMMO_ARRAY;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; FORMAT MRN $15.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_Accession1 - Ar_Accession&amp;amp;M_Accessions. $20.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ExamCode1 - Ar_ExamCode&amp;amp;M_Accessions. $25.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ReasonCode1 - Ar_ReasonCode&amp;amp;M_Accessions. $1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ExamClass1 - Ar_ExamClass&amp;amp;M_Accessions. $15.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_BIRADS1 - Ar_BIRADS&amp;amp;M_Accessions. $5.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_SignedByRAD1 - Ar_SignedByRAD&amp;amp;M_Accessions. $75.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ScheduleDate1 - Ar_ScheduleDate&amp;amp;M_Accessions. DATETIME19.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CompletedDate1 - Ar_CompletedDate&amp;amp;M_Accessions. DATETIME19.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_SignedDate1 - Ar_SignedDate&amp;amp;M_Accessions. DATETIME19.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_BTSd1 - Ar_BTSd&amp;amp;M_Accessions. 8.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CTSm1 - Ar_CTSm&amp;amp;M_Accessions. 8.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CTSd1 - Ar_CTSd&amp;amp;M_Accessions. 8.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; keep MRN&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_Accession1 - Ar_Accession&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ExamCode1 - Ar_ExamCode&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ReasonCode1 - Ar_ReasonCode&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ExamClass1 - Ar_ExamClass&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_BIRADS1 - Ar_BIRADS&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_SignedByRAD1 - Ar_SignedByRAD&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ScheduleDate1 - Ar_ScheduleDate&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CompletedDate1 - Ar_CompletedDate&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_SignedDate1 - Ar_SignedDate&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_BTSd1 - Ar_BTSd&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CTSm1 - Ar_CTSm&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CTSd1 - Ar_CTSd&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Array AR_MRN_Char{6, &amp;amp;M_Accessions.}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_Accession1 - Ar_Accession&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ExamCode1 - Ar_ExamCode&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ReasonCode1 - Ar_ReasonCode&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ExamClass1 - Ar_ExamClass&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_SignedByRAD1 - Ar_SignedByRAD&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_BIRADS1 - Ar_BIRADS&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Array AR_MRN_Num{6, &amp;amp;M_Accessions.}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_ScheduleDate1 - Ar_ScheduleDate&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CompletedDate1 - Ar_CompletedDate&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_SignedDate1 - Ar_SignedDate&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_BTSd1 - Ar_BTSd&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CTSm1 - Ar_CTSm&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Ar_CTSd1 - Ar_CTSd&amp;amp;M_Accessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; do obs = 1 by 1 until (last.MRN);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set RIS_BASE_MAMMO_DER_1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; by MRN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Do j = 1 to 6;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Select (j);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (1) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Char{j, obs} = Accession;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (2) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Char{j, obs} = ExamCode;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (3) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Char{j, obs} = Reason;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (4) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Char{j, obs} = MammoClass;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (5) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Char{j, obs} = SignedBy;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (6) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Char{j, obs} = AssessCode;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; otherwise;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Do j = 1 to 6;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Select (j);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (1) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Num{j, obs} = SchedDTTM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (2) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Num{j, obs} = CompletedDTTM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (3) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Num{j, obs} = SignedDTTM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (4) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Num{j, obs} = BTSd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (5) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if not missing(SignedDTTM) then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Num{j, obs} = round(((SignedDTTM-CompletedDTTM)/3600)); /*Completed to Signed in minutes for ACR comparison*/;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; when (6) do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if not missing(SignedDTTM) then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; AR_MRN_Num{j, obs} = round(((SignedDTTM-CompletedDTTM)/86400)); /*Completed to Signed in days for charting */;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; otherwise;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the obs Data Step variable could be used to somehow, but what that how would be is the question. The preferred layout would be &lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;MRN&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Accession1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ExamCode1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ReasonCode1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ExamClass1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;BIRADS1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;SignedByRAD1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ScheduledDate1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;CompletedDate1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;SignedDate1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;BTSd1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;CTMSm1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;CTSd1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Accession2 (and all the _2 variable in the same order), etc.&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your suggestion of using SQL with the Dictionary table is intriguing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your contribution. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 17:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145351#M38644</guid>
      <dc:creator>CuseBruce</dc:creator>
      <dc:date>2015-01-30T17:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145352#M38645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, OK. Thanks, Reeza, that looks very promising. I want to thank you for your time. I don't think I'll have a chance to develop and test it today, but I'll let you know next week how things go. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 17:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145352#M38645</guid>
      <dc:creator>CuseBruce</dc:creator>
      <dc:date>2015-01-30T17:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145353#M38646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You know the names that you are going to create so just make then in the order you want.&amp;nbsp; Then use them in a LENGTH statement before the ARRAY statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; M_Accessions=10;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; names;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; name :&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$32.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; order + &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; N = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; &amp;amp;M_Accessions;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = cats(name,n);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;output&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;end&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;cards&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;&amp;nbsp; Ar_Accession&lt;BR /&gt;&amp;nbsp; Ar_ExamCode&lt;BR /&gt;&amp;nbsp; Ar_ReasonCode&lt;BR /&gt;&amp;nbsp; Ar_ExamClass&lt;BR /&gt;&amp;nbsp; Ar_BIRADS&lt;BR /&gt;&amp;nbsp; Ar_SignedByRAD&lt;BR /&gt;&amp;nbsp; Ar_ScheduleDate&lt;BR /&gt;&amp;nbsp; Ar_CompletedDate&lt;BR /&gt;&amp;nbsp; Ar_SignedDate&lt;BR /&gt;&amp;nbsp; Ar_BTSd&lt;BR /&gt;&amp;nbsp; Ar_CTSm&lt;BR /&gt;&amp;nbsp; Ar_CTSd&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;;;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=names;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; n order;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;sql&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;noprint&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; name &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; :ordervar separated &lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; names;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;quit&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; NOTE: &amp;amp;=ORDERVAR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 18:13:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145353#M38646</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-01-30T18:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder Variables produced in Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145354#M38647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. You didn't offer me a sample data to test, so I make it on my own . Hope help you a little bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;
data have;
 array x{*} Ar_Accession1 - Ar_Accession12 ;
 array y{*} Ar_ExamCode1 - Ar_ExamCode12;
 array z{*} $ Ar_ReasonCode1 - Ar_ReasonCode12;
do n=1 to 100;
do i=1 to 12;
 x{i}=1;y{i}=2;z{i}='x';
end; 
output;
end;
drop n i;
run;

proc sql;
 select name into : list separated by ' '
&amp;nbsp; from dictionary.columns
&amp;nbsp;&amp;nbsp; where libname='WORK' and memname='HAVE'
&amp;nbsp;&amp;nbsp;&amp;nbsp; order by input(compress(name,,'kd'),best8.),name;
quit;
data want;
 retain &amp;amp;list ;
 set have;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Jan 2015 08:25:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reorder-Variables-produced-in-Array/m-p/145354#M38647</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-31T08:25:33Z</dc:date>
    </item>
  </channel>
</rss>

