<?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: Question about automatic variable type conversions character to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350892#M81629</link>
    <description>This was a rare case that we came across and that variable in question converted to numeric and the imaginary number changed (I forgot what value it turned into). The conversion took place after the data was processed in the data step.</description>
    <pubDate>Tue, 18 Apr 2017 14:59:42 GMT</pubDate>
    <dc:creator>yo1</dc:creator>
    <dc:date>2017-04-18T14:59:42Z</dc:date>
    <item>
      <title>Question about automatic variable type conversions character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/349477#M81055</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find documentation on why one should not mulitply one to a character variable to convert character to numeric (unless its really needed).&amp;nbsp; I found some information on the paper 248-2012 on page 9 about it; however, I know that there is more information warning others not to perform this method other than saying its bad practice or sloppy coding.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any resources about not using&amp;nbsp;this method is greatly apprecated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 14:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/349477#M81055</guid>
      <dc:creator>yo1</dc:creator>
      <dc:date>2017-04-12T14:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Question about automatic variable type conversions character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/349482#M81056</link>
      <description>&lt;P&gt;Personally my opinion is it indicates a lack of understanding of the data involved. If a variable should be numeric then it should be numeric all the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also in some shops there are rules about data standards and messages about type conversion occuring in the log indicate that the standards are not followed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And in general coding terrms how much difference is there really between&lt;/P&gt;
&lt;P&gt;numval = val*1;&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;numval = input(val, best.);&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/349482#M81056</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-12T15:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Question about automatic variable type conversions character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/349568#M81095</link>
      <description>&lt;P&gt;There is no other reason other than bad practice and sloppy coding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually these types of things will mask errors that you won't notice or it will be hard to find actual issues when you have them if you get used to seeing these NOTES and ignoring them. So not coding in this manner will help you in the long run.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/111307"&gt;@yo1&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to find documentation on why one should not mulitply one to a character variable to convert character to numeric (unless its really needed).&amp;nbsp; I found some information on the paper 248-2012 on page 9 about it; however, I know that there is more information warning others not to perform this method other than saying its bad practice or sloppy coding.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any resources about not using&amp;nbsp;this method is greatly apprecated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 19:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/349568#M81095</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-12T19:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Question about automatic variable type conversions character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350886#M81626</link>
      <description>&lt;P&gt;Hello Ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your response. I agree with you in that some shops have rules about data standards and that should be the case especially when a specific data products are looked at carefully by many.&amp;nbsp;&amp;nbsp; However, I disagree with the idea that when a variable is numeric it should stay numeric. I have come across situations where a specific key variable (which is numeric) used in merging tables needs to be converted.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that the numval = input(val, best.); option of converting is the optimal choice; however, I have come across a situation where this type of conversion is not the best choice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, when an algorithm&amp;nbsp;&amp;nbsp; produces a value that is an imaginary number.&amp;nbsp;&amp;nbsp; This element needs to be changed so that the rest of the data series can be used for processing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore the numval = val*1; is better method to use.&amp;nbsp;&amp;nbsp; So I would advocate using numval = val*1; method of converting variable types in cases where there is no other option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;many thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 14:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350886#M81626</guid>
      <dc:creator>yo1</dc:creator>
      <dc:date>2017-04-18T14:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Question about automatic variable type conversions character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350888#M81627</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/111307"&gt;@yo1&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that the numval = input(val, best.); option of converting is the optimal choice; however, I have come across a situation where this type of conversion is not the best choice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, when an algorithm produces a value that is an imaginary number. This element needs to be changed so that the rest of the data series can be used for processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;How can you be sure only imaginary numbers are being converted and you don't have any other issues in your algorithm if you multiply by 1?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 14:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350888#M81627</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-18T14:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Question about automatic variable type conversions character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350889#M81628</link>
      <description>&lt;P&gt;Hello Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your response. &amp;nbsp;I accepted it as the solution.&amp;nbsp; I am still looking for a document that goes into greater detail about the subject. &amp;nbsp;However, you have brought about a good point about the notes appearing in the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Massive thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 14:56:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350889#M81628</guid>
      <dc:creator>yo1</dc:creator>
      <dc:date>2017-04-18T14:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Question about automatic variable type conversions character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350892#M81629</link>
      <description>This was a rare case that we came across and that variable in question converted to numeric and the imaginary number changed (I forgot what value it turned into). The conversion took place after the data was processed in the data step.</description>
      <pubDate>Tue, 18 Apr 2017 14:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-automatic-variable-type-conversions-character-to/m-p/350892#M81629</guid>
      <dc:creator>yo1</dc:creator>
      <dc:date>2017-04-18T14:59:42Z</dc:date>
    </item>
  </channel>
</rss>

