<?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 the last 3 column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537616#M147888</link>
    <description>&lt;P&gt;Interesting idea, so you have a condition which can never be met around the first step which creates all but the var variables in the PDV.&amp;nbsp; Then add the var variables with retain, then add the data.&amp;nbsp; You would have thought you could do this in proc datasets by now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OP: Why do you need to move these?&amp;nbsp; Am just thinking, if its for a report, then your better off just setting the position in the reporting procedure when you assign labels and styles etc.&amp;nbsp; Combine the two saves time and maintenance.&amp;nbsp; If its to follow a specific template for the data, you may be better off creating a template of what the file should look like (all formats, informats, labels etc.) in a file with no observations, then setting that with your data when needed, this way you only need to set structure in the template (one place).&amp;nbsp; There is never, in programming terms a need to move columns as logical position is irrelevant.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Feb 2019 08:15:41 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2019-02-22T08:15:41Z</dc:date>
    <item>
      <title>Reorder the last 3 column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537576#M147869</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a large number of columns and I want to move var1 var2 var3 to the end.&lt;/P&gt;
&lt;P&gt;Since there are many column, I dont want to list too many column in retain.&lt;/P&gt;
&lt;P&gt;I can reorder by taking these 3 column out and SQL it back to the main file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I wonder if there is any easy way to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 02:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537576#M147869</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-02-22T02:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder the last 3 column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537583#M147874</link>
      <description>Try it this way:&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;if 5=4 then do;&lt;BR /&gt;  set have (drop=var1 var2 var3);&lt;BR /&gt;  retain var1 var2 var3;&lt;BR /&gt;end;&lt;BR /&gt;set have;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Technically, you may not need the retain statement.  It gives you control over the order of the last 3 variables.</description>
      <pubDate>Fri, 22 Feb 2019 03:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537583#M147874</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-22T03:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder the last 3 column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537616#M147888</link>
      <description>&lt;P&gt;Interesting idea, so you have a condition which can never be met around the first step which creates all but the var variables in the PDV.&amp;nbsp; Then add the var variables with retain, then add the data.&amp;nbsp; You would have thought you could do this in proc datasets by now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OP: Why do you need to move these?&amp;nbsp; Am just thinking, if its for a report, then your better off just setting the position in the reporting procedure when you assign labels and styles etc.&amp;nbsp; Combine the two saves time and maintenance.&amp;nbsp; If its to follow a specific template for the data, you may be better off creating a template of what the file should look like (all formats, informats, labels etc.) in a file with no observations, then setting that with your data when needed, this way you only need to set structure in the template (one place).&amp;nbsp; There is never, in programming terms a need to move columns as logical position is irrelevant.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 08:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537616#M147888</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-22T08:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder the last 3 column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537831#M147980</link>
      <description>&lt;P&gt;I am working with an existing report each month and need to reorder thing around.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 19:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537831#M147980</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-02-22T19:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder the last 3 column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537837#M147986</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am working with an existing report each month and need to reorder thing around.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Any report method in SAS has re-ordering of the columns built in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In PROC PRINT, it's the VAR command to re-order columns. In PROC REPORT, it's the COLUMNS command to re-order columns. In PROC TABULATE, use the &lt;FONT color="#99CC00"&gt;{I can't remember}&lt;/FONT&gt; command to re-order columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So don't do any programming to re-order columns, just use one of the above tools.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 19:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537837#M147986</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-22T19:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder the last 3 column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537838#M147987</link>
      <description>&lt;P&gt;Thank you for your suggestion but I am not familiar with those proc.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 19:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537838#M147987</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-02-22T19:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder the last 3 column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537840#M147988</link>
      <description>&lt;P&gt;Proc print, report, and tabulate are the standard output procedures of SAS.&amp;nbsp; If you don't know those then you have more problems than just re-arranging.&amp;nbsp; Each procedure has a method to arrange output in a certain way and print or not to print certain variables.&amp;nbsp; Rather than wasting processor cycles and read/write cycles creating a new dataset, use the procedure options.&amp;nbsp; E.g.:&lt;/P&gt;
&lt;PRE&gt;proc report ...;
  columns ... var1 var2 var3;
...
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 20:21:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537840#M147988</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-22T20:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Reorder the last 3 column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537841#M147989</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for your suggestion but I am not familiar with those proc.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then how are you doing the reporting? What PROC are you using? Or are you using a DATA step, with PUT statements?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I add that there are many powerful reporting capabilities in these PROCs, and in the long run, you will get a lot more done, and do it a lot more easily, by learning and using these PROCs. In particular, for relative simple reports, PROC PRINT is about as easy to use as can be.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 20:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reorder-the-last-3-column/m-p/537841#M147989</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-22T20:25:36Z</dc:date>
    </item>
  </channel>
</rss>

