<?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: Ordering fields in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186636#M47408</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mind to create a view for that purpose ? it almost cost no time for you .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data help/view=help;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;retain&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;field1 field2 ...;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set help;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Sep 2014 14:32:43 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2014-09-05T14:32:43Z</dc:date>
    <item>
      <title>Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186634#M47406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quick question...&lt;/P&gt;&lt;P&gt;I know you can order fields by using the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data help;&lt;/P&gt;&lt;P&gt;retain&lt;/P&gt;&lt;P&gt;field1 field2 ...;&lt;/P&gt;&lt;P&gt;set help;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I have a very large data set and I would like a clean way of ordering new variables created along the way a particular way. Is there a way of doing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another question - if you want a new field to appear beside an existing field that is in the middle of your dataset is this possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matthew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2014 16:31:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186634#M47406</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2014-09-04T16:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186635#M47407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With coding you can do a lot.&lt;/P&gt;&lt;P&gt;Changing the order as renaming a variable using proc dataset... no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-thread-small" data-containerid="32" data-containertype="14" data-objectid="35111" data-objecttype="1" href="https://communities.sas.com/thread/35111"&gt;https://communities.sas.com/thread/35111&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2014 16:46:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186635#M47407</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-04T16:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186636#M47408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mind to create a view for that purpose ? it almost cost no time for you .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data help/view=help;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;retain&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;field1 field2 ...;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set help;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 14:32:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186636#M47408</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-09-05T14:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186637#M47409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code generates the following ERROR: UPDATE views are not supported.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The view should have a different name from the original dataset:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data help1/view=help1;&lt;/P&gt;&lt;P style="font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;retain&lt;/P&gt;&lt;P style="font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;field1 field2 ...;&lt;/P&gt;&lt;P style="font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set help;&lt;/P&gt;&lt;P style="font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 17:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186637#M47409</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-09-05T17:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186638#M47410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry . that code is not tested . try this tested one :&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;data have/view=have;&lt;/P&gt;&lt;P&gt; retain age weight height name;&lt;/P&gt;&lt;P&gt; set sashelp.class;&lt;/P&gt;&lt;P&gt; run;&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, 06 Sep 2014 12:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186638#M47410</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-09-06T12:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186639#M47411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ordering fields, why should you bothering about that.&lt;BR /&gt;My statement(1): You are either a lazy coder or nor really knowing how the data is stored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me do some argumentation:&amp;nbsp; &lt;/P&gt;&lt;P&gt;1/ With SAS the language you have logical order defined in the syntax for SAS-datasets. Are you going to use a RDBMS SQL that that order definition (*) does not exist.&lt;BR /&gt;2/ With a SAS datastep you are using a PDV (Program-Data-Vector) it is document the a variable when it gets defined that will be the order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Statement(2): The order of the variables in a SAS dataset (stored) is not the order you are seeing/thinking while processing the dataset.&lt;/P&gt;&lt;P&gt;Ha Hypothesis The order of the variables is the one you are seeing&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hb the order of the variables is NOT the one you are seeing. &lt;BR /&gt;Prove:&lt;/P&gt;&lt;P&gt;Xia's program is working the retain approach will show the variables is an different order. But is not changing the type char/numeric and length of the variables&lt;/P&gt;&lt;P&gt;As the variables only can get a place in the PDV with the complete length information being known the retain is only defining the order in some kind of table not being the real storage place in the PDV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can we find additional information for this prove?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See reference 1:&lt;/P&gt;&lt;P&gt;"In SAS 6 of the SAS System, the position of variables on a SAS data set is determined by the order in which they are encountered regardless of their type or length. In order to improve performance, SAS 7 and beyond of the SAS System positions 8 byte and 4 byte numeric variables at 8 byte boundaries at the front of a SAS data set."&lt;/P&gt;&lt;P&gt;See refrence 2:&lt;/P&gt;&lt;P class="xis-paragraph"&gt;&lt;A id="n0y07rrfrw29wrn1to4v38j3v9zv"&gt;&lt;/A&gt;"When SAS processes the program data vector, it typically moves the data in one large operation rather than by individual variables. When data is properly aligned (in 8-byte boundaries), data movement can occur in as little as two clock cycles (a single load followed by a single store). SAS moves unaligned data by more complex means, at worst, a single byte at a time. This would be at least eight times slower for an 8-byte variable.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P class="xis-paragraph"&gt;&lt;A id="p0lljrmfh4iw0dn0zulujfkkqxuu"&gt;&lt;/A&gt;Many high-performance RISC (Reduced Instruction Set Computer) processors pay a very large performance penalty for movement of unaligned data. When possible, leave numeric data at full width (eight bytes). Note that SAS must widen short numeric data for any arithmetic operation. On the other hand, short numeric data can save both memory and &lt;SPAN class="xis-nobr"&gt;I/O&lt;/SPAN&gt;. You must determine which method is most advantageous for your operating environment and situation. "&lt;/P&gt;&lt;P class="xis-paragraph"&gt;&lt;/P&gt;&lt;P class="xis-paragraph"&gt;How can the data-view approach be effective reordering the data?&lt;/P&gt;&lt;P class="xis-paragraph"&gt;This question arises when going to use statistical procedures on this reordered dataset. The only way I see is that the data is fully processed by the datastep and then fed to the proc instead of feeding the data immediate. Additional research on performance aspects is needed.&lt;/P&gt;&lt;P class="xis-paragraph"&gt;&lt;/P&gt;&lt;P&gt;Conclusion&lt;/P&gt;&lt;P&gt;Reliabililty of statement(2) is 100% an confidence interval is not applicable. &lt;/P&gt;&lt;P&gt;Statement(1) is left to the reader.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;External references&lt;/P&gt;&lt;P&gt;1* &lt;A href="http://support.sas.com/kb/2/676.html" title="http://support.sas.com/kb/2/676.html"&gt;2676 - Determining the order of variables within a SAS data set&lt;/A&gt; &lt;/P&gt;&lt;P&gt;2* &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/67401/HTML/default/viewer.htm#p13nid2jwm0dq7n105fqdwy3mpwb.htm#p04li9lmns0fu1n1ru55t0kp9zh7" title="http://support.sas.com/documentation/cdl/en/lrcon/67401/HTML/default/viewer.htm#p13nid2jwm0dq7n105fqdwy3mpwb.htm#p04li9lmns0fu1n1ru55t0kp9zh7"&gt;SAS(R) 9.4 Language Reference: Concepts, Third Edition&lt;/A&gt; Specifying Variable Lengths&amp;nbsp;&amp;nbsp;&amp;nbsp; Techniques for Optimizing CPU Performance&lt;/P&gt;&lt;P&gt;3* Xia program as dd 06-0-2014&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data have/view=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain age weight height name;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Sep 2014 06:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186639#M47411</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-07T06:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186640#M47412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can only physically re-order columns in a table by fully re-creating the table. Question is: Why is it important to you in which order the variables are stored? It shouldn't matter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Sep 2014 07:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186640#M47412</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-09-07T07:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186641#M47413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="8872" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: I don't disagree with your facts, but I don't agree with your premise. I don't think reordering variables is a definite sign of either laziness or not understanding how SAS works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reordering the way that variables appear (both to the user and the PDV) has its benefits, particularly in using variable lists and in reviewing data. Your non-lazy programmer is wasting a lot of time typing when they could have been using variable lists, more prone to unnecessary error and, if they're on a case sensitive operating system, more likely to make errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How SAS actually stores the variables in such cases is irrelevant to the discussion as far as I can see. The following is a way to move a variable to the middle, with no side effects that I'm aware of (unless, of course, one decides to accomplish more in the final data step than simply reordering the variables):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain X1-X10 y1-y10 (20*1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :reorder separated by " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="HAVE" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum le 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outer union corr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="HAVE" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum eq 21&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outer union corr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="HAVE" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11 le varnum le 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain &amp;amp;reorder.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Sep 2014 16:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186641#M47413</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-09-07T16:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186642#M47414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Usually people care about the order of the fields in their tables because they are actively using the data.&amp;nbsp; If you want to examine the data using generic interactive tools (like SAS display manager) then the order that the data is presented makes a big difference in how easy the data is to use.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Sep 2014 17:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186642#M47414</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-09-07T17:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186643#M47415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Tom your argument of examining data using interactive tools is a valid one.&lt;/P&gt;&lt;P&gt;The retain trick Xia's program and add Arthurs one to that, with a data/view will work but needing an additional step. It will work even with an external DBMS. The involved overhead is not a recommendation to be used that with real analytics.&amp;nbsp; The trick Arthurs is proposing is having a last step replacing the data. This will cause making a full copy (writing) of the data. That could be a problem as of sizing (real&amp;nbsp; big data) "side effect-1" or as of security the dataset is in a DWH copying the data is not being allowed side "effect-2".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for SAS datasets you Tom and Arthur can agree that the physical order is different to the logical one.&amp;nbsp; &lt;BR /&gt;SAS-institute could offer a simple logical reordering as part of "proc datasets".&amp;nbsp; They choosed not to do that, please explain why.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While using the SAS procedures there is no PDV and often there is just a small subset of all variables involved.&lt;/P&gt;&lt;P&gt;The best way to handle that is where processing as dataset option and only naming the needed variables.&amp;nbsp; "side effect-3"&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;They decided not to do that. Their effort on data processing is going at In-database processing and in-memory analytics.&lt;/P&gt;&lt;P&gt;That is seeming to moving away from a pc-based approach "side effect-4".&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;The analytics is&amp;nbsp; moving to a more click-mick approach as seen wit Eminer and a lot of other solutions.&amp;nbsp; Within those you are expected to a "do not code" habit. Typos are of history as do not type anymore and much longer used variable names are coming along&amp;nbsp; "side effect-5".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arthur where you do not see any side effects, I can see 5. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Sep 2014 18:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186643#M47415</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-07T18:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186644#M47416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="8872" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: I was only mentioning the data mishandling problems that can occur if one attempt to use retain to do re-ordering. Yes, of course, the side effects you mentioned exist and will continue to exist if SAS doesn't provide a way to simply modify the viewed/addressed_with_variable_list order (and, while it may not be called a pdv, variable lists can be used with all SAS procs).&lt;/P&gt;&lt;P&gt;However, SAS continues to choose not to, thus the kind of side effects you mentioned are also always there if one needs to modify/resturcture/add variables, etc. to their data.&lt;/P&gt;&lt;P&gt;As for procs and systems that are geared to only use point and click operations, and no code, I prefer to feed SAS data into R. I was extremely disappointed when SAS decided to not output or allow one to run EM with code. I'd really hate to see how much error has been introduced, but never noticed, because of that decision.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Sep 2014 19:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186644#M47416</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-09-07T19:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186645#M47417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arthur, for the first point we can agree assume. For the second points you could add now own code nodes with Eminer. You always can review the code and you can add R as node under some conditions.&amp;nbsp; I am mad enough to go for the support and implement those features and check their functionality.&lt;/P&gt;&lt;P&gt;The whole implementation is a technical nightmare to get well working. The statistical instability could be there, I had some distrust on some point not getting clear.&lt;/P&gt;&lt;P&gt;Your statistical distrust can be even greater looking what they are trying to do with SAS-VA. push some buttons and you get nice figures with predictions the intrepretation and evaluation of what is shown getting out of focus. That is another way of quick results but could winning a battle losing the war.&amp;nbsp; Ah we can agree on your second point too I see.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Sep 2014 19:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186645#M47417</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-07T19:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186646#M47418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's then may-be where metadata should come into play, be it as information maps or as a table metadata object and a library definition accessing data via metadata layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Sep 2014 23:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186646#M47418</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-09-07T23:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186647#M47419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your helpful code. Just a quick question. My dataset consists of about 100 columns and what I'm attempting to do is to create two new field (claim_amt and claim_no) and place it next to an existing field (claim_type) which is currently halfway through the dataset (column 50).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to use your code but where you can dynamically find the position of the field claim_type rather than manually working out the position of the column where you want to place the new fields. Also, if there are two fields rather than 1(from your code) what amendments to your code are required?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to clairify why I need this.... I export to excel so the presentation of the dataset is important and needs to follow a logical order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matthew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 08:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186647#M47419</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2014-09-08T08:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186648#M47420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would use a multiple datastep merge with itself, each time with a block of variables already in wanted order order:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; merge have (keep = 1st variable in dataset -- claim_type) /* this keeps all varibles in between*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have (keep = claim_amt claim_no)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have (keep = 1st variable after claim_type -- last variable before claim_amt)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have (keep = ... ); /*if there are variables after claim_no */&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on the setting of the SAS option MERGENOBY you may get a warning that merge is done without a BY statement, you can ignore here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 12:22:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186648#M47420</guid>
      <dc:creator>HWSteinberg</dc:creator>
      <dc:date>2014-09-08T12:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186649#M47421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is one way to do it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have (drop=i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain X1-X10 claim_type y1-y10 (21*1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data to_add;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat claim_amt comma8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat claim_no $3.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input claim_amt claim_no;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;86.42 001&lt;/P&gt;&lt;P&gt;5,680.00&amp;nbsp; 002&lt;/P&gt;&lt;P&gt;257.00&amp;nbsp; 003&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set to_add;&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;&amp;nbsp; select varnum&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :first_end&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="WANT" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="claim_type"&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :reorder separated by " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="WANT" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum le &amp;amp;first_end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outer union corr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="TO_ADD"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;;&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;&amp;nbsp; retain &amp;amp;reorder.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 15:08:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186649#M47421</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-09-08T15:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186650#M47422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Arthur&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That works perfect however, when I try to move two fields form the middle to the end (rather than the other way around) it does't work. In the example above if you wanted to move claim_type to the right of the new variables at the end?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 16:30:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186650#M47422</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2014-09-08T16:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering fields</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186651#M47423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have (drop=i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain X1-X10 claim_type y1-y10 (21*1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data to_add;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat claim_amt comma8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat claim_no $3.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input claim_amt claim_no;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;86.42 001&lt;/P&gt;&lt;P&gt;5,680.00&amp;nbsp; 002&lt;/P&gt;&lt;P&gt;257.00&amp;nbsp; 003&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set to_add;&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;&amp;nbsp; select varnum&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :first_end&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="WANT" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="claim_type"&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :reorder separated by " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="WANT" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum lt &amp;amp;first_end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outer union corr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="WANT" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum gt &amp;amp;first_end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outer union corr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="WORK" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="WANT" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum eq &amp;amp;first_end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain &amp;amp;reorder.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 16:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Ordering-fields/m-p/186651#M47423</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-09-08T16:52:48Z</dc:date>
    </item>
  </channel>
</rss>

