<?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: Replace the order of new Variable in the old variable Position...! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796373#M255543</link>
    <description>&lt;P&gt;If you are "recalculating" value perhaps just set them to missing and reuse the old names. Change the LABEL to reflect the change if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;DATA NEW(DROP=make);
   SET SASHELP.cars;
   call missing( TYPE, Horsepower);
   Type='All';
   Horsepower=1000;
RUN;

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Feb 2022 18:48:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-02-15T18:48:54Z</dc:date>
    <item>
      <title>Replace the order of new Variable in the old variable Position...!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796359#M255537</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;I need help in replacing the position of old variable with the new variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA NEW(DROP=make);
SET SASHELP.cars;
DROP TYPE Horsepower;
Type_new='All';
Horsepower_new=1000;
RENAME Type_new=Type Horsepower_new=Horsepower;
RUN;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the above example:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The new variables are positioned at the end of the dataset. But, I want these variables to be in the same position i.e., at the original horsepower and type position(which are dropped in the data step).&lt;/P&gt;
&lt;P&gt;How do we do that in the same data step?&lt;/P&gt;
&lt;P&gt;Please note that the drop variables (data set option) and the new variable creation would be changing depending on the requirement. This should be dynamic in a way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Prad&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 18:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796359#M255537</guid>
      <dc:creator>prad001</dc:creator>
      <dc:date>2022-02-15T18:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Replace the order of new Variable in the old variable Position...!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796363#M255538</link>
      <description>&lt;P&gt;I have to say that changing the order of variables in a SAS data set is usually unnecessary. Regardless of your intended use, the data set itself doesn't have to have variables in any particular order. PROCs such as PROC PRINT and PROC TABULATE and PROC REPORT allow the order of the variables to be set easily when you use these PROCs.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 18:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796363#M255538</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-15T18:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replace the order of new Variable in the old variable Position...!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796366#M255539</link>
      <description>How do you know which new variable matches with which old variable?&lt;BR /&gt;Is the naming convention shown here something you can rely on?</description>
      <pubDate>Tue, 15 Feb 2022 18:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796366#M255539</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-15T18:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Replace the order of new Variable in the old variable Position...!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796368#M255540</link>
      <description>The new variables will have an "_new" extension.</description>
      <pubDate>Tue, 15 Feb 2022 18:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796368#M255540</guid>
      <dc:creator>prad001</dc:creator>
      <dc:date>2022-02-15T18:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Replace the order of new Variable in the old variable Position...!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796373#M255543</link>
      <description>&lt;P&gt;If you are "recalculating" value perhaps just set them to missing and reuse the old names. Change the LABEL to reflect the change if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;DATA NEW(DROP=make);
   SET SASHELP.cars;
   call missing( TYPE, Horsepower);
   Type='All';
   Horsepower=1000;
RUN;

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 18:48:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796373#M255543</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-15T18:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Replace the order of new Variable in the old variable Position...!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796386#M255551</link>
      <description>&lt;P&gt;As you assigning new values to variables in&amp;nbsp;&lt;STRONG&gt;ALL&lt;/STRONG&gt; observations, you don't need to assign missing values to them.&amp;nbsp;Anyhow yoy can control order of variables to show when you open the dataset by using FORMAT statement with or without a format, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA NEW(DROP=make);
  FORMAT &amp;lt;1st_var&amp;gt; &amp;lt;2nd_var&amp;gt; &amp;lt;3rd_var&amp;gt; ... ;
   SET SASHELP.cars;
   Type='All';
   Horsepower=1000;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Feb 2022 19:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/796386#M255551</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2022-02-15T19:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replace the order of new Variable in the old variable Position...!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/797261#M255916</link>
      <description>OMG.. This is exactly what I am looking for. Thank you Ballard.</description>
      <pubDate>Fri, 18 Feb 2022 16:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-the-order-of-new-Variable-in-the-old-variable-Position/m-p/797261#M255916</guid>
      <dc:creator>prad001</dc:creator>
      <dc:date>2022-02-18T16:07:48Z</dc:date>
    </item>
  </channel>
</rss>

