<?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: rename field with () in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682754#M206696</link>
    <description>&lt;P&gt;Sorry, but I read right over your solution.&amp;nbsp; Checking the View Columns the Label is the (Do Not Modfy)Contact but the variable name is _Do_Not_Modify Contact&amp;nbsp; with modify actually spelled correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So thank you for your help.&amp;nbsp; Still learned something new on the name literal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 19:55:59 GMT</pubDate>
    <dc:creator>wlierman</dc:creator>
    <dc:date>2020-09-09T19:55:59Z</dc:date>
    <item>
      <title>rename field with ()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682717#M206676</link>
      <description>&lt;P&gt;I am trying to rename a variable that is labeled (Do Not Modfy) Contact&amp;nbsp; (modify is misspelled in the file).&amp;nbsp; I try a simple rename in the Data Step:&lt;/P&gt;
&lt;PRE&gt;Data Arias.System_contacts (rename = ((Do Not Modfy)Contact = Contact_number));
  Set ARIAS.System_Contacts_per_tracer;
run;&lt;/PRE&gt;
&lt;P&gt;That results in the following error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;84   Data Arias.System_contacts (rename = ((Do Not Modfy)Contact = Contact_number));
                                           -
                                           214
                                           23
                                            --
                                            79
ERROR 214-322: Variable name ( is not valid.

ERROR 23-7: Invalid value for the RENAME option.

ERROR 79-322: Expecting a =.

85     Set ARIAS.System_Contacts_per_tracer;
86   run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


&lt;/PRE&gt;
&lt;P&gt;I've tried some alternatives such as placing the rename&amp;nbsp; and label statements in the Data Step. But still get an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your assistance in solving this problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 17:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682717#M206676</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-09-09T17:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: rename field with ()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682718#M206677</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65907"&gt;@wlierman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to rename a variable that is &lt;FONT color="#FF0000"&gt;labeled&lt;/FONT&gt; (Do Not Modfy) Contact&amp;nbsp; (modify is misspelled in the file).&amp;nbsp; I try a simple rename in the Data Step:&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you mean that the variable NAME is&amp;nbsp;(Do Not Modfy) Contact? Not the variable LABEL is&amp;nbsp;(Do Not Modfy) Contact?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets library=arias nolist; 
modify system_contacts;
rename '(Do Not Modfy) Contact'n = contact_number;
run; quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Although your text has a space between Modfy) and Contact, but your code does not. So which is it? You need to pay attention to details like this.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 17:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682718#M206677</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-09T17:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: rename field with ()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682719#M206678</link>
      <description>&lt;P&gt;If your variable has characters that are other than a letter, digit or _&amp;nbsp; character then you have to use the name literal form with is the entire text of the variable enclosed in quotes with an n immediately following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if your variable name is&lt;/P&gt;
&lt;PRE&gt;(Do Not Modfy)Contact&lt;/PRE&gt;
&lt;P&gt;then you &lt;STRONG&gt;always &lt;/STRONG&gt;have to reference it as "&lt;/P&gt;
&lt;PRE&gt;'(Do Not Modfy)Contact'n&lt;/PRE&gt;
&lt;P&gt;or write a data step to read the data such that you don't get such ugly names. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 17:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682719#M206678</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-09T17:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: rename field with ()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682751#M206695</link>
      <description>&lt;P&gt;I ran the code and while it may look like there is a space between the ) and Contact there isn't any extra space.&amp;nbsp; So I ran this&lt;/P&gt;
&lt;PRE&gt;Data Arias.System_contacts (rename = ( '(Do Not Modfy)Contact'n = Contact_number));
  Set ARIAS.System_Contacts_per_tracer;
run;&lt;/PRE&gt;
&lt;P&gt;and got the following log result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;99   Data Arias.System_contacts (rename = ( '(Do Not Modfy)Contact'n = Contact_number));
                                            ------------------------
                                            214
                                            23
ERROR 214-322: Variable name '(Do Not Modfy)Contact'n is not valid.

ERROR 23-7: Invalid value for the RENAME option.

100    Set ARIAS.System_Contacts_per_tracer;
101  run;
&lt;/PRE&gt;
&lt;P&gt;I tried one additional space between the closing ' and n but still no successful run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any there another approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 19:51:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682751#M206695</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-09-09T19:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: rename field with ()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682754#M206696</link>
      <description>&lt;P&gt;Sorry, but I read right over your solution.&amp;nbsp; Checking the View Columns the Label is the (Do Not Modfy)Contact but the variable name is _Do_Not_Modify Contact&amp;nbsp; with modify actually spelled correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So thank you for your help.&amp;nbsp; Still learned something new on the name literal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 19:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682754#M206696</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-09-09T19:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: rename field with ()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682756#M206697</link>
      <description>&lt;P&gt;Yes.&amp;nbsp; I read right over the solution by Paige.&amp;nbsp; The label is the ugly expression.&amp;nbsp; But the variable name is _Do_Not_Modify Contact&amp;nbsp; which is still not all that straightforward but at least has modify spelled correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This also ties to your answer too.&amp;nbsp; Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 19:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/rename-field-with/m-p/682756#M206697</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-09-09T19:59:00Z</dc:date>
    </item>
  </channel>
</rss>

