<?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: Changing pre-existing character variable to numeric variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813663#M321158</link>
    <description>I also tried this and it worked as well! Thank you so much</description>
    <pubDate>Tue, 17 May 2022 02:48:29 GMT</pubDate>
    <dc:creator>JibJam221</dc:creator>
    <dc:date>2022-05-17T02:48:29Z</dc:date>
    <item>
      <title>Changing pre-existing character variable to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813658#M321154</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;im having some issues changing one of my variables from Character ($CHAR1.) to numeric (BEST12.) so that I can append it to another table. The variable's format that im trying to change is a pre-existing variable within the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my current code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.test2;&lt;BR /&gt;set work.test;&lt;BR /&gt;SYD=input(SYD,BEST12.);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I run this code, I dont get any errors or warnings however the variable doesn't change formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions on what I can do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 02:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813658#M321154</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2022-05-17T02:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Changing pre-existing character variable to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813660#M321155</link>
      <description>&lt;P&gt;Variables can't change their type.&amp;nbsp; But you can work around it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.test2;
   set test;
   newvar = input(SYD, best12.);
   drop SYD;
   rename newvar = SYD;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 May 2022 02:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813660#M321155</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-05-17T02:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Changing pre-existing character variable to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813661#M321156</link>
      <description>&lt;P&gt;Is the following NOTE being output to the log?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="japelin_0-1652754165052.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71513i766C17B3BD86E55E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="japelin_0-1652754165052.png" alt="japelin_0-1652754165052.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This means that an implicit conversion is taking place because the result of converting SYD to a number with the input function is stored in a character variable.&lt;BR /&gt;Since SAS does not allow variable type change, rename is required as follows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.test2(drop=_SYD);
  set work.test(rename=(SYD=_SYD));
  SYD=input(_SYD,BEST12.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 02:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813661#M321156</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-05-17T02:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Changing pre-existing character variable to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813662#M321157</link>
      <description>it worked! Thank you!!!</description>
      <pubDate>Tue, 17 May 2022 02:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813662#M321157</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2022-05-17T02:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Changing pre-existing character variable to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813663#M321158</link>
      <description>I also tried this and it worked as well! Thank you so much</description>
      <pubDate>Tue, 17 May 2022 02:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-pre-existing-character-variable-to-numeric-variable/m-p/813663#M321158</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2022-05-17T02:48:29Z</dc:date>
    </item>
  </channel>
</rss>

