<?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 Rename one variable with two variable names in one step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rename-one-variable-with-two-variable-names-in-one-step/m-p/680187#M205503</link>
    <description>&lt;P&gt;I want to rename the variable 'Expense' to 'VALUE_LC' and 'VALUE_TC' in one step. When I tried the code below, only the latest rename statement comes into effect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'VALUE_LC' and 'VALUE_TC'&amp;nbsp; are different variables and it should have the values same as 'Expense' variable. Any help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
set HAVE_A;
rename Expense=VALUE_LC;
rename Expense=VALUE_TC;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 29 Aug 2020 07:38:06 GMT</pubDate>
    <dc:creator>David_Billa</dc:creator>
    <dc:date>2020-08-29T07:38:06Z</dc:date>
    <item>
      <title>Rename one variable with two variable names in one step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-one-variable-with-two-variable-names-in-one-step/m-p/680187#M205503</link>
      <description>&lt;P&gt;I want to rename the variable 'Expense' to 'VALUE_LC' and 'VALUE_TC' in one step. When I tried the code below, only the latest rename statement comes into effect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'VALUE_LC' and 'VALUE_TC'&amp;nbsp; are different variables and it should have the values same as 'Expense' variable. Any help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
set HAVE_A;
rename Expense=VALUE_LC;
rename Expense=VALUE_TC;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Aug 2020 07:38:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-one-variable-with-two-variable-names-in-one-step/m-p/680187#M205503</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-08-29T07:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Rename one variable with two variable names in one step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-one-variable-with-two-variable-names-in-one-step/m-p/680188#M205504</link>
      <description>&lt;P&gt;After first rename done, the origin name does not exist;&lt;/P&gt;
&lt;P&gt;you can do either:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;value_lc = expense;
rename expense = value_tc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;value_lc = expense;
value_tc = expense;
drop expense;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or any other similar combination.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Aug 2020 08:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-one-variable-with-two-variable-names-in-one-step/m-p/680188#M205504</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-29T08:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Rename one variable with two variable names in one step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-one-variable-with-two-variable-names-in-one-step/m-p/680192#M205507</link>
      <description>&lt;P&gt;You misunderstand what&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n0x16kvqkxxdx5n1t04voifvo8wo.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;RENAME&lt;/A&gt;&amp;nbsp;does. Follow the link to the documentation, and you will see that the statement has no effect for the current data step code, only for the output dataset(s). Since the current name is still valid within the data step, you can use the RENAME again, but only the last one will have a lasting effect. And it only &lt;EM&gt;changes the name&lt;/EM&gt; of an existing variable, but it does not create a new one. Therefore you cannot have two new variables for one that exists.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Aug 2020 11:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-one-variable-with-two-variable-names-in-one-step/m-p/680192#M205507</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-29T11:40:02Z</dc:date>
    </item>
  </channel>
</rss>

