<?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 Converting Character to Numeric to Character with Conversion Factor? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490838#M128556</link>
    <description>&lt;P&gt;I am trying to convert a few character variables to numeric, perform a conversion and then for one variable convert back to character.&lt;BR /&gt;I am struggling with the code. I had been using this page for reference: &lt;A href="https://blogs.sas.com/content/sgf/2015/05/01/converting-variable-types-do-i-use-put-or-input/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2015/05/01/converting-variable-types-do-i-use-put-or-input/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is a picture of the variables I have, variables I want, their formats, and the calculation for the conversion factor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, surely there is a way to do this without lengthy&amp;nbsp;format and informat statements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help!&lt;/P&gt;</description>
    <pubDate>Wed, 29 Aug 2018 13:39:12 GMT</pubDate>
    <dc:creator>_Grove_</dc:creator>
    <dc:date>2018-08-29T13:39:12Z</dc:date>
    <item>
      <title>Converting Character to Numeric to Character with Conversion Factor?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490838#M128556</link>
      <description>&lt;P&gt;I am trying to convert a few character variables to numeric, perform a conversion and then for one variable convert back to character.&lt;BR /&gt;I am struggling with the code. I had been using this page for reference: &lt;A href="https://blogs.sas.com/content/sgf/2015/05/01/converting-variable-types-do-i-use-put-or-input/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2015/05/01/converting-variable-types-do-i-use-put-or-input/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is a picture of the variables I have, variables I want, their formats, and the calculation for the conversion factor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, surely there is a way to do this without lengthy&amp;nbsp;format and informat statements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 13:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490838#M128556</guid>
      <dc:creator>_Grove_</dc:creator>
      <dc:date>2018-08-29T13:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to Numeric to Character with Conversion Factor?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490841#M128558</link>
      <description>&lt;P&gt;Convert character to numeric&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;num_var=char_var+0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Convert numeric to character&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;char_var = cats(num_var);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Aug 2018 13:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490841#M128558</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-08-29T13:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to Numeric to Character with Conversion Factor?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490852#M128567</link>
      <description>&lt;P&gt;Char to number, put()&lt;/P&gt;
&lt;P&gt;Number to char, input()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are specific reasons why these should be used.&amp;nbsp; You supply the formats/informats.&amp;nbsp; Whilst&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s suggestion of adding 0 to a character string is sufficient, this uses something called implicit conversion, this can lead to bugs in your code which is very hard to debug.&amp;nbsp; Always use input() or put() to convert data from one type to another, not just for completeness sake but also to make code nice and clean and illegible, i.e. it shows that you are converting.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 14:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490852#M128567</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-29T14:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to Numeric to Character with Conversion Factor?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490862#M128574</link>
      <description>&lt;P&gt;Who is the cruel taskmaster forcing you to do this?&amp;nbsp; If a variable is numeric, store it as numeric don't store it as character.&amp;nbsp; You might have to learn how to display it in a format for reporting purposes.&amp;nbsp; But it is senseless to continually jump through these conversion hoops.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 14:25:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-Numeric-to-Character-with-Conversion/m-p/490862#M128574</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-29T14:25:00Z</dc:date>
    </item>
  </channel>
</rss>

