<?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 a bunch of variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194571#M48837</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Assuming that the variables are in a table called PRODUCT in the WORK library, I would use dictionary tables to get the variable names and then run through a macro loop using the TRANWRD() function to change all the names like this:&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_a=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_b=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_c=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_d=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_e=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_f=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; compress(put(count(name),&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;best.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; :nvars &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.vcolumn &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; libname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"WORK"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp; memname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"PRODUCT"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; name &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; :var1-:var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;nvars.&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.vcolumn &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; libname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"WORK"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp; memname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"PRODUCT"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;option&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;mprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;STRONG&gt;&lt;EM&gt;ChangeVarName&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;data product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;nvars.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; rename &amp;amp;&amp;amp;var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;i.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(tranwrd(&amp;amp;&amp;amp;var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;i.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'product'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'xml'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; ChangeVarName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;ChangeVarName&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;option&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;nomprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;There is a bug in this with the tranwrd function.&amp;nbsp; Maybe someone else on this forum can help me correct it if you can't see my mistake on your own.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Mar 2015 21:12:53 GMT</pubDate>
    <dc:creator>djbateman</dc:creator>
    <dc:date>2015-03-04T21:12:53Z</dc:date>
    <item>
      <title>rename a bunch of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194569#M48835</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 have a bunch of variables named as product_a, product_b, product_c etc. Is there a quick way to rename all of them into xlm_a, xlm_b, xlm_c...&amp;nbsp; i.e., replace the "product" into "xlm" for all variables starting with "product".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note, I have a lot of these types of data, so simply doing rename on each data will be tedious. So ideally, I need some macro looping through all files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 20:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194569#M48835</guid>
      <dc:creator>Sunny_Sun</dc:creator>
      <dc:date>2015-03-04T20:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: rename a bunch of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194570#M48836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If they were product_1 product_2 etc. with a sequential number, renaming is very easy with the data step RENAME statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If they are really variables whose name ends with characters instead of sequential numbers, I think you'd have to write a macro. or maybe trick PROC SQL to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So which case is it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 20:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194570#M48836</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-03-04T20:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: rename a bunch of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194571#M48837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Assuming that the variables are in a table called PRODUCT in the WORK library, I would use dictionary tables to get the variable names and then run through a macro loop using the TRANWRD() function to change all the names like this:&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_a=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_b=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_c=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_d=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_e=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_f=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'&lt;SPAN style="color: #800080; font-family: 'SAS Monospace'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;blah&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; compress(put(count(name),&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;best.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; :nvars &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.vcolumn &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; libname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"WORK"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp; memname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"PRODUCT"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; name &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; :var1-:var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;nvars.&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.vcolumn &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; libname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"WORK"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp; memname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"PRODUCT"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;option&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;mprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;STRONG&gt;&lt;EM&gt;ChangeVarName&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;data product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;nvars.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; rename &amp;amp;&amp;amp;var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;i.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(tranwrd(&amp;amp;&amp;amp;var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;i.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'product'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'xml'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10pt; font-family: 'SAS Monospace';"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; ChangeVarName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;ChangeVarName&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;option&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;nomprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;There is a bug in this with the tranwrd function.&amp;nbsp; Maybe someone else on this forum can help me correct it if you can't see my mistake on your own.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 21:12:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194571#M48837</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-03-04T21:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: rename a bunch of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194572#M48838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured it out.&amp;nbsp; I needed to use the %str() functionality for the parameters of the tranwrd() function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_a=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_b=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_c=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_d=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_e=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_f=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; compress(put(count(name),&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;best.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; :nvars &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.vcolumn &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; libname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"WORK"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp; memname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"PRODUCT"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; name &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; :var1-:var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;nvars.&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.vcolumn &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; libname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"WORK"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp; memname=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: purple; background: white;"&gt;"PRODUCT"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;option&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;mprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;STRONG&gt;&lt;EM&gt;ChangeVarName&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;data product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;nvars.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; rename &amp;amp;&amp;amp;var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;i.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(tranwrd(&amp;amp;&amp;amp;var&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;i.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(product),&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(xml)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; ChangeVarName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;ChangeVarName&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;option&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;nomprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 21:35:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194572#M48838</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-03-04T21:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: rename a bunch of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194573#M48839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's likely the bug is because of the quotes.&amp;nbsp; Since macro language is executing the function (via %SYSFUNC), the quotes around 'product' and 'xml' should be removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One issue to watch for is the list of variable names.&amp;nbsp; In the sample code, every variable name begins with "product_".&amp;nbsp; Some of the logic may have to be adjusted if there are other variable names in the data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All in all, this is a very viable approach for a single data set.&amp;nbsp; Looping through many data sets may require some knowledge about how you plan to identify the location and names of the data sets.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 21:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194573#M48839</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-03-04T21:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: rename a bunch of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194574#M48840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I think would be an efficient way to do what you want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test_a='blah';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_a='blah';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_something='blah';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_c='blah';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_d='blah';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_e='blah';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_f='blah';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table vars as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname='WORK' and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname='HAVE' and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name =: 'product'&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set vars end=lastone;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_ eq 1 then call execute('proc datasets library=work; modify have;rename ');&lt;/P&gt;&lt;P&gt;&amp;nbsp; exstmt=catt(name,'=xlm',substr(name,8))||' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute(exstmt);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if lastone then call execute(';run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 21:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194574#M48840</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-03-04T21:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: rename a bunch of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194575#M48841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you search this forum with key words "rename variables" you will find quite a few threads with all sorts of use cases and solutions to it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 21:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194575#M48841</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-03-04T21:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: rename a bunch of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194576#M48842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;A reply amongst many possible others.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Suppose one wants to rename variables starting with "a" with "z";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;A cat has more than 1 way to lick its paw (this is a family show).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/*******************/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/*** sample data ***/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/*******************/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data t_a;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;input aaa aab aac pa $ pb $ pc $ @@;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;cards;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;1 2 3 A B C 4 5 6 D E F&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/******************/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/*** a solution ***/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/******************/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; set t_a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; length xx xy $50.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; array v_num(*) _numeric_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; array v_chr(*) _character_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; if _N_&amp;gt;1 then stop;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; if _N_ =1 then do;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute('proc datasets noprint; modify t_a; rename ');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 1 to dim(v_num);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(vname(v_num(i)),1,1)='a' then do;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xx= compress('z'||substr(vname(v_num(i)),2));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(vname(v_num(i))||'='||xx||' ');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 1 to dim(v_chr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(vname(v_chr(i)),1,1)='a' then do;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xx= compress('z'||substr(vname(v_chr(i)),2));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(vname(v_chr(i))||'='||xx||' ');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute('; quit; run;');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 22:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/rename-a-bunch-of-variables/m-p/194576#M48842</guid>
      <dc:creator>billfish</dc:creator>
      <dc:date>2015-03-04T22:12:32Z</dc:date>
    </item>
  </channel>
</rss>

