<?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: Converting Variable From Numeric to Character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691867#M210650</link>
    <description>&lt;P&gt;Very likely, it would be simpler to (for comparison purposes) convert from character to numeric:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;from INPUT_DATA as t1

left join gl_codes as t3
on input(t1.account, 12.) = t3.gl_code&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just pick a wide enough width ... this example assumes that ACCOUNT will be no longer than 12 characters.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2020 15:18:31 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2020-10-15T15:18:31Z</dc:date>
    <item>
      <title>Converting Variable From Numeric to Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691856#M210644</link>
      <description>&lt;P&gt;Hi SAS Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You've got a newbie in the building when it comes to SQL, so please be gentle as to date I have been using EG in anything I've been carrying out.&amp;nbsp; I've been told that I have a really simple piece of existing code that can just be ran without issue, but it's throwing up an error on step 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error "Expression using equals (=) has components that are of different data types"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've determined that the code is trying to pull in a numerical value against a left join that has a character value but I don't know how to write the code to change the numerical to character apart from thinking it needs to read something like gl_codes=put(account,8)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from INPUT_DATA as t1&lt;/P&gt;&lt;P&gt;left join gl_codes as t3&lt;BR /&gt;on t1.account =t3.gl_code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;gl_codes is numeric&lt;/P&gt;&lt;P&gt;account is character (LENGTH8)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 14:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691856#M210644</guid>
      <dc:creator>Lauror</dc:creator>
      <dc:date>2020-10-15T14:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Variable From Numeric to Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691858#M210646</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;on t1.account = put(t3.gl_code,8.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 14:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691858#M210646</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-15T14:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Variable From Numeric to Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691865#M210649</link>
      <description>&lt;P&gt;Follow Maxim 3 and get to know your data:&lt;/P&gt;
&lt;P&gt;How many digits are stored in account? Are there leading zeroes? Are the values left- or right-aligned?&lt;/P&gt;
&lt;P&gt;This will determine how you do the conversion of the numeric variable.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 15:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691865#M210649</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-15T15:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Variable From Numeric to Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691867#M210650</link>
      <description>&lt;P&gt;Very likely, it would be simpler to (for comparison purposes) convert from character to numeric:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;from INPUT_DATA as t1

left join gl_codes as t3
on input(t1.account, 12.) = t3.gl_code&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just pick a wide enough width ... this example assumes that ACCOUNT will be no longer than 12 characters.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 15:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/691867#M210650</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-10-15T15:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Variable From Numeric to Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/692649#M211033</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;If your goal is to convert a numeric variable to a character variable you must use the "PUT" function.&lt;BR /&gt;The PUT function is as follows:&lt;BR /&gt;new_variable = PUT (original_variable, format.);&lt;BR /&gt;&lt;BR /&gt;If your goal is to convert a character variable to a numeric variable, you must then use the "INPUT" function,&lt;BR /&gt;The INPUT function is as follows:&lt;BR /&gt;new_variable = INPUT (original_variable, informat.);&lt;BR /&gt;&lt;BR /&gt;I hope these two functions help with your future conversions of variables.&lt;BR /&gt;&lt;BR /&gt;De'Janae'</description>
      <pubDate>Mon, 19 Oct 2020 18:07:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Variable-From-Numeric-to-Character/m-p/692649#M211033</guid>
      <dc:creator>DeJanae07</dc:creator>
      <dc:date>2020-10-19T18:07:31Z</dc:date>
    </item>
  </channel>
</rss>

