<?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: variable name change in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140553#M37576</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, way I would do it is:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.vcolumn (where=(libname="SASHELP" and memname="CLASS")) end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_=1 then call execute('data want; set sashelp.class (rename=(');&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute(' '||strip(name)||'='||substr(name,1,3)||'_hello_'||strip(substr(name,4)));&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last then call execute(')); run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also do it in SQL, i.e. select into macro variable, then use that macro variable as your rename. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Dec 2014 09:54:24 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2014-12-08T09:54:24Z</dc:date>
    <item>
      <title>variable name change</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140550#M37573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Am reading data from excel sheet, in that i dont know how many colums are there. &lt;/P&gt;&lt;P&gt;I want to place * after 3 characters of every column name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample column names of excel sheet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) customer_id&lt;/P&gt;&lt;P&gt;2) member_id&lt;/P&gt;&lt;P&gt;3) customer_name&lt;/P&gt;&lt;P&gt;4) address&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Desired output column names:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) cus*tomer_id&lt;/P&gt;&lt;P&gt;2) mem*ber_id&lt;/P&gt;&lt;P&gt;3) cus*tomer_name&lt;/P&gt;&lt;P&gt;4) add*ress&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Dec 2014 08:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140550#M37573</guid>
      <dc:creator>gsreddy</dc:creator>
      <dc:date>2014-12-08T08:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: variable name change</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140551#M37574</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;Having an asterix (*) in a dataset is not valid.&amp;nbsp; So you will not be able to do what you want there.&lt;/P&gt;&lt;P&gt;Also, if your data is in Excel, then I would strongly suggest you save to CSV, then write the import program yourself using datastep/infile/input statements.&amp;nbsp; You can then set labels, names formats etc. and have control over your import rather than letting proc import guess for you.&amp;nbsp; You still wont be able to use asterixs in the variable name however. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Dec 2014 09:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140551#M37574</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-12-08T09:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: variable name change</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140552#M37575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi RW9&lt;/P&gt;&lt;P&gt;Is it possible to place '_hello_' instead of * ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Dec 2014 09:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140552#M37575</guid>
      <dc:creator>gsreddy</dc:creator>
      <dc:date>2014-12-08T09:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: variable name change</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140553#M37576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, way I would do it is:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.vcolumn (where=(libname="SASHELP" and memname="CLASS")) end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_=1 then call execute('data want; set sashelp.class (rename=(');&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute(' '||strip(name)||'='||substr(name,1,3)||'_hello_'||strip(substr(name,4)));&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last then call execute(')); run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also do it in SQL, i.e. select into macro variable, then use that macro variable as your rename. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Dec 2014 09:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140553#M37576</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-12-08T09:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: variable name change</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140554#M37577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's simply a very bad idea as such names are not valid SAS names &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/67885/HTML/default/viewer.htm#p18cdcs4v5wd2dn1q0x296d3qek6.htm" title="http://support.sas.com/documentation/cdl/en/lrcon/67885/HTML/default/viewer.htm#p18cdcs4v5wd2dn1q0x296d3qek6.htm"&gt;SAS(R) 9.4 Language Reference: Concepts, Fourth Edition&lt;/A&gt;. It could be done but then you would have to reference all your SAS variables in all your code as SAS name literals in the form: &lt;STRONG&gt;'&lt;/STRONG&gt;cus*tomer ID&lt;STRONG&gt;'n&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For such requirements use variable labels instead. SAS Procedures creating reports allow you to use the variable labels instead of the variable names for "printed" output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other question you're having is: How can I change variable names and variable attributes in a SAS data set using code (=automated)? This is a question which came up already many times in this forum and I suggest you do a search.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Dec 2014 10:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-name-change/m-p/140554#M37577</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-12-08T10:25:42Z</dc:date>
    </item>
  </channel>
</rss>

