<?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: Change a name of variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790953#M253276</link>
    <description>There's also a WHERE clause in that code though....</description>
    <pubDate>Wed, 19 Jan 2022 16:48:19 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-01-19T16:48:19Z</dc:date>
    <item>
      <title>Change a name of variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790942#M253268</link>
      <description>&lt;P&gt;I'm trying to change a name of variable but the variable inside the excel file has spaces and a hyphen (idk if this interferes in anything) and when i'm putting it to assign a new name,a parte of it is in red and i do not can change&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gbatista_0-1642608867806.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67507iDBDB10672C2DA8DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gbatista_0-1642608867806.png" alt="gbatista_0-1642608867806.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;photo 1: file in excel replicated with the column name to be changed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gbatista_1-1642608994012.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67508i2BA39088B1E650BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gbatista_1-1642608994012.png" alt="gbatista_1-1642608994012.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;photo 2: the code i'm trying to do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gbatista_2-1642609052206.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67509iEA4BE1BE58CD2E81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gbatista_2-1642609052206.png" alt="gbatista_2-1642609052206.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;photo 3: the error&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 16:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790942#M253268</guid>
      <dc:creator>gbatista</dc:creator>
      <dc:date>2022-01-19T16:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change a name of variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790945#M253270</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gbatista_0-1642609131260.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67511i7BB4BBA219CC3759/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gbatista_0-1642609131260.png" alt="gbatista_0-1642609131260.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;photo 3**&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 16:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790945#M253270</guid>
      <dc:creator>gbatista</dc:creator>
      <dc:date>2022-01-19T16:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Change a name of variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790948#M253271</link>
      <description>&lt;P&gt;Post your code as text not images.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You forgot the RENAME statement for starters. Your code would reassign variables, not rename them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how a rename should work.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
rename sex = gender;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Verify the actual names in your data set using PROC CONTENTS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=class;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Make sure to also refer to the name using the name literal format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 16:32:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790948#M253271</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-01-19T16:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change a name of variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790951#M253274</link>
      <description>&lt;P&gt;For large datasets, the DATA step approach using RENAME is incredibly inefficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Better: you should get in the habit of using PROC DATASETS if all you want to do is rename a variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets library=work nolist;
    modify yourdatasetname;
    change oldvariablename=newvariablename;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jan 2022 16:45:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790951#M253274</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-19T16:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Change a name of variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790953#M253276</link>
      <description>There's also a WHERE clause in that code though....</description>
      <pubDate>Wed, 19 Jan 2022 16:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790953#M253276</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-01-19T16:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change a name of variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790955#M253277</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;There's also a WHERE clause in that code though....&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I said: "... get in the habit of using PROC DATASETS &lt;FONT color="#FF0000"&gt;if all you want to do is rename a variable&lt;/FONT&gt;."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So I think we agree.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 17:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-a-name-of-variable/m-p/790955#M253277</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-19T17:01:58Z</dc:date>
    </item>
  </channel>
</rss>

