<?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: renaming a variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71642#M20684</link>
    <description>Check your DATA statement, also your SAS log should identify the problem.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Fri, 26 Mar 2010 19:46:12 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-03-26T19:46:12Z</dc:date>
    <item>
      <title>renaming a variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71641#M20683</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have a variable from a data set which I receive everyday from different programmers.  Some would id number.  Some would have it as character and some numeric.  My program should check the format of the output and name it PID.&lt;BR /&gt;
&lt;BR /&gt;
For this I tried this code but the renaming happens anyway.&lt;BR /&gt;
&lt;BR /&gt;
data data;&lt;BR /&gt;
      set &amp;amp;data;&lt;BR /&gt;
      if (vformatn(&amp;amp;idvar) eq '$') then do;&lt;BR /&gt;
       pid=input(&amp;amp;idvar, 8.);&lt;BR /&gt;
      end;&lt;BR /&gt;
      else do;&lt;BR /&gt;
        rename &amp;amp;idvar=pid;&lt;BR /&gt;
      end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
So the result is the character to numeric conversion never stays.&lt;BR /&gt;
&lt;BR /&gt;
Please suggest something.&lt;BR /&gt;
&lt;BR /&gt;
Thank you,&lt;BR /&gt;
Sandhya.</description>
      <pubDate>Fri, 26 Mar 2010 19:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71641#M20683</guid>
      <dc:creator>Sandhya</dc:creator>
      <dc:date>2010-03-26T19:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: renaming a variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71642#M20684</link>
      <description>Check your DATA statement, also your SAS log should identify the problem.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 26 Mar 2010 19:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71642#M20684</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-26T19:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: renaming a variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71643#M20685</link>
      <description>I fixed it.&lt;BR /&gt;
&lt;BR /&gt;
Instead of renaming it I assigned it to pid.&lt;BR /&gt;
&lt;BR /&gt;
instead of rename &amp;amp;idvar=pid;&lt;BR /&gt;
&lt;BR /&gt;
I used pid=&amp;amp;idvar;&lt;BR /&gt;
&lt;BR /&gt;
Sandhya.</description>
      <pubDate>Fri, 26 Mar 2010 19:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71643#M20685</guid>
      <dc:creator>Sandhya</dc:creator>
      <dc:date>2010-03-26T19:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: renaming a variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71644#M20686</link>
      <description>Do consider that the RENAME statement is not a type that has conditional execution.  Your SAS variable rename process will occur regardless of the DO/END code piece.&lt;BR /&gt;
&lt;BR /&gt;
It appears you may be using SAS macro language, so you may explore converting the DATA step DO/END to a macro %DO/%END, if appropriate.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 26 Mar 2010 20:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-a-variable/m-p/71644#M20686</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-26T20:09:33Z</dc:date>
    </item>
  </channel>
</rss>

