<?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 Column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138557#M27983</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the variables are actually "named" in Hebrew, then you will have to consider if SAS is able to handle DBCS at that level (syntax objects instead of just data) before renaming.&lt;/P&gt;&lt;P&gt;I used the double quotes because in Excel these are not names, just data in the first row.&lt;/P&gt;&lt;P&gt;You may be better off by&lt;/P&gt;&lt;P&gt;- exporting excel content into csv&lt;/P&gt;&lt;P&gt;- write a data step manually to import, starting in row 2.&lt;/P&gt;&lt;P&gt;That way you discard the different names for identical columns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, did you try the double quotes?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Oct 2014 13:59:18 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2014-10-23T13:59:18Z</dc:date>
    <item>
      <title>Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138549#M27975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Hello, i would like to rename a column in data set.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;example : i want to rename a column which name is &amp;amp;B_AccountNumber for Account.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;the problem is that the name in macro variable &amp;amp;B_AccountNumber &lt;SPAN style="color: #000000; font-family: Arial, 'Lucida Grande', Raanana, sans-serif; background-color: #ffffff;"&gt;composed of two words(with blank, for example : &amp;amp;B_AccountNumber=Account Number). if &amp;amp;B_AccountNumber is composed from one word, algorithm works perfectly.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;data Balance_update;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;set Balance (rename=(&amp;amp;B_AccountNumber=Account));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What should i do?&lt;/P&gt;&lt;P&gt;i tried to write &lt;SPAN style="font-size: 12pt;"&gt;(rename=(&lt;STRONG&gt;'&lt;/STRONG&gt;&amp;amp;B_AccountNumber&lt;STRONG&gt;'n&lt;/STRONG&gt;=Account))&lt;/SPAN&gt;&lt;STRONG style="font-size: 12pt;"&gt; but is not work!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Alexey&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 08:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138549#M27975</guid>
      <dc:creator>Alexey</dc:creator>
      <dc:date>2014-10-23T08:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138550#M27976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would firstly question why you want to do this in this fashion, there are many possibilities for mistakes.&amp;nbsp; Perhaps provide an example and it could be done differently.&amp;nbsp; As for your issue with blanks, not sure where B_accountnumber is created, I would suggest at that point would be the best to process the text into a useable format&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; call symput('b_accountnumber',tranwrd("my model"," ","_"));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data Balance_update;&lt;BR /&gt;&amp;nbsp; set sashelp.cars (rename=(make=&amp;amp;B_AccountNumber.));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 08:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138550#M27976</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-23T08:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138551#M27977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use "&amp;amp;B_AccountNumber"n.&lt;/P&gt;&lt;P&gt;Note the double quotes. Single quotes prevent the handling of macro elements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 08:34:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138551#M27977</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-10-23T08:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138552#M27978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Further question: what causes the column in Balance to have a name that does not meet the SAS requirements for a column/variable name?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 08:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138552#M27978</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-10-23T08:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138553#M27979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, thank you for your answer.&lt;/P&gt;&lt;P&gt;I import excel files, and in every excel i have different variable name. my aim is convert every variable name to unique variable&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; name that will be identical across different files.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;the next problem that the names of variable is in Hebrew... Sometimes they consist from two words with blank.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 09:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138553#M27979</guid>
      <dc:creator>Alexey</dc:creator>
      <dc:date>2014-10-23T09:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138554#M27980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Hello, thank you for your answer.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I import excel files, and in every excel i have different variable name. my aim is convert every variable name to unique variable&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; name that will be identical across different files.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;the next problem that the names of variable is in Hebrew... Sometimes they consist from two words with blank, sometimes, one word, sometimes three words. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 09:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138554#M27980</guid>
      <dc:creator>Alexey</dc:creator>
      <dc:date>2014-10-23T09:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138555#M27981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not just do:&lt;/P&gt;&lt;P&gt;proc import datafile='....xls' out=temp replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getnames=no;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; range='A1:...';&amp;nbsp; /* not sure if datarows=1 works here */&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;and let proc import assign col1-colx to each variable?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 12:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138555#M27981</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-23T12:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138556#M27982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't mention where you get the contents for your macro variable, so I will assume that you have multiple sources for the excel files you want to import.&lt;/P&gt;&lt;P&gt;In source A, account number is the third column, in source B, account number is the 5th column, etc.&amp;nbsp; So you have predefined macro variables:&lt;/P&gt;&lt;P&gt;%LET A_AccountNumber = AccountNum;&lt;/P&gt;&lt;P&gt;%LET B_AccountNumber = Customer Account;&lt;/P&gt;&lt;P&gt;%LET C_AccountNumber = Cust. Nbr.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT we know that when SAS imports the excel file, it will convert all spaces and punctuation to underscores, so your variable names become:&lt;/P&gt;&lt;P&gt;%LET A_AccountNumber = AccountNum;&lt;/P&gt;&lt;P&gt;%LET B_AccountNumber = Customer_Account;&lt;/P&gt;&lt;P&gt;%LET C_AccountNumber = Cust__Nbr_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF you are already predefining, then you can take care of this right away.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 13:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138556#M27982</guid>
      <dc:creator>cwilson</dc:creator>
      <dc:date>2014-10-23T13:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138557#M27983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the variables are actually "named" in Hebrew, then you will have to consider if SAS is able to handle DBCS at that level (syntax objects instead of just data) before renaming.&lt;/P&gt;&lt;P&gt;I used the double quotes because in Excel these are not names, just data in the first row.&lt;/P&gt;&lt;P&gt;You may be better off by&lt;/P&gt;&lt;P&gt;- exporting excel content into csv&lt;/P&gt;&lt;P&gt;- write a data step manually to import, starting in row 2.&lt;/P&gt;&lt;P&gt;That way you discard the different names for identical columns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, did you try the double quotes?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 13:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Column/m-p/138557#M27983</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-10-23T13:59:18Z</dc:date>
    </item>
  </channel>
</rss>

